Re: Command line search and replace

2001-01-10 Thread kmself
on Tue, Jan 09, 2001 at 08:30:59PM -0500, Jonathan D. Proulx ([EMAIL PROTECTED]) wrote: > On Tue, Jan 09, 2001 at 11:29:31AM -0800, kmself@ix.netcom.com wrote: > :on Tue, Jan 09, 2001 at 08:20:18AM -0500, Jonathan D. Proulx ([EMAIL > PROTECTED]) wrote: > > :> find . -name *.txt -exec cp {} {}.tm

Re: Command line search and replace

2001-01-10 Thread Joey Hess
Jonathan D. Proulx wrote: > also note that you must quote the wildcard '*.txt' to prevent shell > expantion, but I feel the example stands bugs and all. Using xargs or > for i in `find . -name '*.txt'` can result in stack overflows if there > are alot of file (I don't know howmany, but it happened

Re: Command line search and replace

2001-01-09 Thread Jonathan D. Proulx
On Tue, Jan 09, 2001 at 11:29:31AM -0800, kmself@ix.netcom.com wrote: :on Tue, Jan 09, 2001 at 08:20:18AM -0500, Jonathan D. Proulx ([EMAIL PROTECTED]) wrote: :> find . -name *.txt -exec cp {} {}.tmp \; -exec sed s/foo/boo/g {} \; :> :> or writing a small shell/perl/sed/awk/whatever script that

Re: Command line search and replace

2001-01-09 Thread kmself
on Tue, Jan 09, 2001 at 08:20:18AM -0500, Jonathan D. Proulx ([EMAIL PROTECTED]) wrote: > On Mon, Jan 08, 2001 at 11:52:26PM -0800, kmself@ix.netcom.com wrote: > > :> My vote for most elegant: > :> > :> find . -name *.txt -exec sed s/foo/boo/g {} \; > :> {} refers to file found

[Sorry] Re: Command line search and replace

2001-01-09 Thread Erdmut Pfeifer
sorry guys, I actually didn't intend to bounce that message -- I had the focus on the wrong X window while typing something unrelated, which obviously turned out to be a valid mutt key sequence... Anyway, thanks for your effort :-) (ok, ok, I'll shut up now...) On Tue, Jan 09, 2001 at 02:33:34

Re: Command line search and replace

2001-01-09 Thread list
csj schrieb: > On Mon, Jan 08, 2001 at 12:56:45AM +0800, I wrote: > > Is there a tool to do a search-and-replace from the command line? > > Something along the lines of: > > > > replace "string one" "string foo" files-to-process > > sed is it! Thanks to John <[EMAIL PROTECTED]>, Michal > <[EMAI

Re: Command line search and replace

2001-01-09 Thread Jonathan D. Proulx
On Mon, Jan 08, 2001 at 11:52:26PM -0800, kmself@ix.netcom.com wrote: :> My vote for most elegant: :> :> find . -name *.txt -exec sed s/foo/boo/g {} \; :> {} refers to file found ^ ^must have \; to terminate :> -exec : :This solution doe

Re: Command line search and replace

2001-01-09 Thread kmself
on Mon, Jan 08, 2001 at 05:53:51PM -0500, Jonathan D. Proulx ([EMAIL PROTECTED]) wrote: > On Tue, Jan 09, 2001 at 12:54:34AM +0800, csj wrote: > > :for i in *.txt ; do mv $i $i.tmp ; sed s/foo/boo/g $i.tmp > $i ; done > : > :Can anybody comment on this little script? This appears to work, but >

Re: Command line search and replace

2001-01-08 Thread Jonathan D. Proulx
On Tue, Jan 09, 2001 at 12:54:34AM +0800, csj wrote: :for i in *.txt ; do mv $i $i.tmp ; sed s/foo/boo/g $i.tmp > $i ; done : :Can anybody comment on this little script? This appears to work, but :may be inefficient. And it's one step removed from what I want, :recursive processing. That is, to

Re: Command line search and replace

2001-01-08 Thread Robert L. Yelvington
then do this: for i in `find . -name *.txt` ; do blah ; done and make sure you know what you're doing. cheers, robt csj wrote: > > On Mon, Jan 08, 2001 at 12:56:45AM +0800, I wrote: > > Is there a tool to do a search-and-replace from the command line? > > Something along the lines of: > > > >

Re: Command line search and replace

2001-01-08 Thread Christoph Simon
On Tue, 9 Jan 2001 00:54:34 +0800 csj <[EMAIL PROTECTED]> wrote: > On Mon, Jan 08, 2001 at 12:56:45AM +0800, I wrote: > > Is there a tool to do a search-and-replace from the command line? > > Something along the lines of: > > > > replace "string one" "string foo" files-to-process > > sed is it!

Re: Command line search and replace

2001-01-08 Thread csj
On Mon, Jan 08, 2001 at 12:56:45AM +0800, I wrote: > Is there a tool to do a search-and-replace from the command line? > Something along the lines of: > > replace "string one" "string foo" files-to-process sed is it! Thanks to John <[EMAIL PROTECTED]>, Michal <[EMAIL PROTECTED]>, und eechi von

Re: Command line search and replace

2001-01-08 Thread Joachim Ostwald
csj wrote: > Is there a tool to do a search-and-replace from the command line? > Something along the lines of: > > replace "string one" "string foo" files-to-process > > I find it a bit of a hassle to keep 100+ files open just to change an > ".html" to an ".htm." Note however that I intend to u

Re: Command line search and replace

2001-01-08 Thread kmself
on Mon, Jan 08, 2001 at 01:42:08AM +0800, eechi von akusyumi ([EMAIL PROTECTED]) wrote: > suggestion: > > cat file | sed s/search/replace/gi >file2;cp file2 file1; Note that this solution creates an additional process for each file handled. The more elegant solution is: $ sed -e '/search/s

Re: Command line search and replace

2001-01-08 Thread N. Raghavendra
On Sun, Jan 07, 2001 at 06:12:54PM +0100, Michal F. Hanula wrote: > On Mon, Jan 08, 2001 at 12:56:45AM +0800, csj wrote: > > Is there a tool to do a search-and-replace from the command > > line? Something along the lines of: > > > > replace "string one" "string foo" files-to-process > > > > I fin

Re: Command line search and replace

2001-01-07 Thread eechi von akusyumi
suggestion: cat file | sed s/search/replace/gi >file2;cp file2 file1; - Original Message - From: "John Hasler" <[EMAIL PROTECTED]> To: Sent: Monday, January 08, 2001 1:29 AM Subject: Re: Command line search and replace > csj writes: > > Is there a tool to

Re: Command line search and replace

2001-01-07 Thread John Hasler
csj writes: > Is there a tool to do a search-and-replace from the command line? > Something along the lines of: > replace "string one" "string foo" files-to-process Look at awk and sed. -- John Hasler [EMAIL PROTECTED] Dancing Horse Hill Elmwood, Wisconsin

Re: Command line search and replace

2001-01-07 Thread Michal F. Hanula
On Mon, Jan 08, 2001 at 12:56:45AM +0800, csj wrote: > Is there a tool to do a search-and-replace from the command line? > Something along the lines of: > > replace "string one" "string foo" files-to-process > > I find it a bit of a hassle to keep 100+ files open just to change an > ".html" to