Re: how to substutue string in a text file

2003-01-27 Thread Bret Hughes
On Mon, 2003-01-27 at 17:17, Cameron Simpson wrote: > On 09:56 26 Jan 2003, Bret Hughes <[EMAIL PROTECTED]> wrote: > | > | the g/foo/ one I am going to have to read up on before beginning to ask > | > | a question about it :) > | > > | > Thinks of it like a pre-grep for the target lines. > | > |

Re: how to substutue string in a text file

2003-01-27 Thread Cameron Simpson
On 09:56 26 Jan 2003, Bret Hughes <[EMAIL PROTECTED]> wrote: | > | the g/foo/ one I am going to have to read up on before beginning to ask | > | a question about it :) | > | > Thinks of it like a pre-grep for the target lines. | | Yeah I get the g/foo/ part it is the .-2,.+2m0 that looks like gi

Re: how to substutue string in a text file

2003-01-26 Thread Bret Hughes
On Sun, 2003-01-26 at 03:35, Cameron Simpson wrote: > On 21:27 14 Jan 2003, Bret Hughes <[EMAIL PROTECTED]> wrote: > | Am I close? this is more flexible than trying to build a regex that > | would do the same thing in the syntax I have used in the past. I never > | have sucessfully atomized let

Re: how to substutue string in a text file

2003-01-26 Thread Cameron Simpson
On 21:27 14 Jan 2003, Bret Hughes <[EMAIL PROTECTED]> wrote: | On Tue, 2003-01-14 at 20:50, Cameron Simpson wrote: | > It separates selection from operation. It says, "globally, for all lines | > containing abdfggg, substitute that (// being 'that') with opsmsdd". | > | > You can do more flexible

Re: how to substutue string in a text file

2003-01-15 Thread Robert P. J. Day
On 14 Jan 2003, Bret Hughes wrote: > the g/foo/ one I am going to have to read up on before beginning to ask > a question about it :) > > Bret one of my favorite applications of that operator is to print all lines containing a pattern while in vi with: :g//p as in :g/root/p the pattern

Re: how to substutue string in a text file

2003-01-14 Thread Bret Hughes
On Tue, 2003-01-14 at 20:50, Cameron Simpson wrote: > On 11:01 14 Jan 2003, Bret Hughes <[EMAIL PROTECTED]> wrote: > | On Mon, 2003-01-13 at 13:18, Samuel Flory wrote: > | > [EMAIL PROTECTED] wrote: > | > >or try: > | > >:g/abdfggg/s//opsmsdd/g from vi/vim > | > > | > That's really the hard way. >

Re: how to substutue string in a text file

2003-01-14 Thread Cameron Simpson
On 11:01 14 Jan 2003, Bret Hughes <[EMAIL PROTECTED]> wrote: | On Mon, 2003-01-13 at 13:18, Samuel Flory wrote: | > [EMAIL PROTECTED] wrote: | > >or try: | > >:g/abdfggg/s//opsmsdd/g from vi/vim | > | > That's really the hard way. | > :%s/abdfggg/opsmsdd/g works just as well and makes more sense.

Re: how to substutue string in a text file

2003-01-14 Thread Bret Hughes
On Mon, 2003-01-13 at 13:18, Samuel Flory wrote: > [EMAIL PROTECTED] wrote: > > >or try: > >:g/abdfggg/s//opsmsdd/g from vi/vim > > > > > > > > That's really the hard way. > > :%s/abdfggg/opsmsdd/g works just as well and makes more sense. > This is the vi syntax I am familier with. What is

Re: how to substutue string in a text file

2003-01-13 Thread Samuel Flory
[EMAIL PROTECTED] wrote: or try: :g/abdfggg/s//opsmsdd/g from vi/vim That's really the hard way. :%s/abdfggg/opsmsdd/g works just as well and makes more sense. PS- Remember that you can use anything as a delimiter in both vim and sed. sed -e s/abcde/edcba/ is the same as sed -e s,abc

RE: how to substutue string in a text file

2003-01-13 Thread Cliff Wells
On Mon, 2003-01-13 at 05:45, Jianping Zhu wrote: > Thanks. > but a little confused by your advice > can u give more detail? Use sed, as was advised by Ric Tibbetts. That is what it's made for. Forget anything else. sed 's/abdfggg/opsmsdd/g' originalfile.txt > newfile.txt > Thanks > > On Mon,

RE: how to substutue string in a text file

2003-01-13 Thread Cliff Wells
On Mon, 2003-01-13 at 06:06, Rechenberg, Andrew wrote: > I don't believe that you can't substitute with grep or find. Do you > have access to sed? > > sed -e 's/abdfgg/opsmsdd/g' filename > outputfilename > > If you have multiple files with text you wish to replace, then you could > use 'grep -R

Re: how to substutue string in a text file

2003-01-13 Thread Mark Lundy
How about sed? sed s/abdfggg/opsmsdd/g text_file Mark [EMAIL PROTECTED] wrote: or try: :g/abdfggg/s//opsmsdd/g from vi/vim Good luck Bob Jack Bowling <[EMAIL PROTECTED]> wrote: On Mon, Jan 13, 2003 at 08:21:44AM -0500, Jianping Zhu wrote: how to substutue string in a text file by u

Re: how to substutue string in a text file

2003-01-13 Thread iverger
or try: :g/abdfggg/s//opsmsdd/g from vi/vim Good luck Bob Jack Bowling <[EMAIL PROTECTED]> wrote: >On Mon, Jan 13, 2003 at 08:21:44AM -0500, Jianping Zhu wrote: >> >> how to substutue string in a text file by using "gerp" or "find"? >> >> I have a text file, lof of "abdfggg" in that text fil

Re: how to substutue string in a text file

2003-01-13 Thread Jack Bowling
On Mon, Jan 13, 2003 at 08:21:44AM -0500, Jianping Zhu wrote: > > how to substutue string in a text file by using "gerp" or "find"? > > I have a text file, lof of "abdfggg" in that text file, i need to change > it to "opsmsdd", is there a simple way to do that? Retrieve chgrep from freshmeat.ne

Re: how to substutue string in a text file

2003-01-13 Thread T. Ribbrock
On Mon, Jan 13, 2003 at 08:55:42AM -0500, Robert P. J. Day wrote: [...] > my apologies -- i'd forgotten that that command comes with > the mysql RPM. replace is also available separately - see: http://replace.richardlloyd.org.uk/ Cheerio, Thomas --

Re: how to substutue string in a text file

2003-01-13 Thread Tibbetts, Ric
Jianping Zhu wrote: how to substutue string in a text file by using "gerp" or "find"? I have a text file, lof of "abdfggg" in that text file, i need to change it to "opsmsdd", is there a simple way to do that? sed is your friend. sed 's/abdfggg/opsmsdd/g' > That will replace ALL instances

RE: how to substutue string in a text file

2003-01-13 Thread Rechenberg, Andrew
I don't believe that you can't substitute with grep or find. Do you have access to sed? sed -e 's/abdfgg/opsmsdd/g' filename > outputfilename If you have multiple files with text you wish to replace, then you could use 'grep -R' to find them and if you're replacing with the same text in each fi

RE: how to substutue string in a text file

2003-01-13 Thread Rick Carroll
om: Jianping Zhu [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 8:46 AM To: [EMAIL PROTECTED] Subject: RE: how to substutue string in a text file Thanks. but a little confused by your advice can u give more detail? Thanks On Mon, 13 Jan 2003, Rick Carroll wrote: >

Re: how to substutue string in a text file

2003-01-13 Thread Robert P. J. Day
On Mon, 13 Jan 2003, Jianping Zhu wrote: > i use "man replace" but find nothing > > how to use replace? > > Thanks > > On Mon, 13 Jan 2003, Robert P. J. Day wrote: > > > On Mon, 13 Jan 2003, Jianping Zhu wrote: > > > > > > > > how to substutue string in a text file by using "gerp" or "find"

RE: how to substutue string in a text file

2003-01-13 Thread Jianping Zhu
Thanks. but a little confused by your advice can u give more detail? Thanks On Mon, 13 Jan 2003, Rick Carroll wrote: > Use back-ticks `` (like single quotes in the opposite direction) around your >command. > Example MYVAR=`grep foo bar` > > This redirects the standard out of a command into a

Re: how to substutue string in a text file

2003-01-13 Thread Jianping Zhu
i use "man replace" but find nothing how to use replace? Thanks On Mon, 13 Jan 2003, Robert P. J. Day wrote: > On Mon, 13 Jan 2003, Jianping Zhu wrote: > > > > > how to substutue string in a text file by using "gerp" or "find"? > > > > I have a text file, lof of "abdfggg" in that text file

RE: how to substutue string in a text file

2003-01-13 Thread Rick Carroll
Use back-ticks `` (like single quotes in the opposite direction) around your command. Example MYVAR=`grep foo bar` This redirects the standard out of a command into a variable. Rick -Original Message- From: Jianping Zhu [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 8:

Re: how to substutue string in a text file

2003-01-13 Thread Robert P. J. Day
On Mon, 13 Jan 2003, Jianping Zhu wrote: > > how to substutue string in a text file by using "gerp" or "find"? > > I have a text file, lof of "abdfggg" in that text file, i need to change > it to "opsmsdd", is there a simple way to do that? there's always the "replace" command. rday -- re