Re: Search Replace in multiple files

2004-02-11 Thread Rob Dixon
Chetak Sasalu wrote: I came back to office after an extended weekend and realized that my words might have irked some of you. 'Irked' is a good word. I'll happily forgive just because of that, plus the fact that I know that I also can be irksome. Rob -- To unsubscribe, e-mail: [EMAIL

RE: Search Replace in multiple files

2004-02-10 Thread chetak.sasalu
Hello, I came back to office after an extended weekend and realized that my words might have irked some of you. But let me explain. I agree, acquiring the 'mental tools' to do it myself is always the best way. I had tried out a few sample scripts myself (most of them failed). After

Re: Search Replace in multiple files

2004-02-07 Thread Rob Dixon
John W. Krahn wrote: Chetak Sasalu wrote: Hi, Hello, I have to search and replace 'foo' to 'bar' in all the files in a directory(has subdirectories). The files are about 40k in size. On the command line I would do it as, find ./mydir/ -type f -print | xargs perl -pi -e

Re: Search Replace in multiple files

2004-02-07 Thread Rob Dixon
Jan Eden wrote: Rob Dixon wrote: John W. Krahn wrote: use File::Find; local ( $^I, @ARGV ) = ''; find( { no_chdir = 1, wanted = sub { -f and push @ARGV, $_ } }, './mydir' ); s/foo/bar/g, print while ; Thanks John. I missed the 'has subdirectories'. I did not and came up

Re: Search Replace in multiple files

2004-02-07 Thread Jan Eden
Rob Dixon wrote: Jan Eden wrote: Rob Dixon wrote: John W. Krahn wrote: use File::Find; local ( $^I, @ARGV ) = ''; find( { no_chdir = 1, wanted = sub { -f and push @ARGV, $_ } }, './mydir' ); s/foo/bar/g, print while ; Thanks John. I missed the 'has subdirectories'. I did not and came up

Re: Search Replace in multiple files

2004-02-06 Thread Jan Eden
[EMAIL PROTECTED] wrote: Hi, I have to search and replace 'foo' to 'bar' in all the files in a directory(has subdirectories). The files are about 40k in size. What is the most efficient way to implement this inside a perl program ? There are about 30 files to be processed. I went through

Re: Search Replace in multiple files

2004-02-06 Thread Jan Eden
Please disregard my post, I mixed up the magic and the less magic FILEHANDLE. -- These are my principles and if you don't like them... well, I have others. - Groucho Marx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Search Replace in multiple files

2004-02-06 Thread Rob Dixon
Chetak Sasalu wrote: I have to search and replace 'foo' to 'bar' in all the files in a directory(has subdirectories). The files are about 40k in size. On the command line I would do it as, find ./mydir/ -type f -print | xargs perl -pi -e 's/foo/bar/' No backup of the original files

Re: Search Replace in multiple files

2004-02-06 Thread Randy W. Sims
On 02/06/04 07:45, [EMAIL PROTECTED] wrote: PS: I see this term 'foo' 'bar' in many programming books, what is the etymology of this? It is derived from a technical acronym FUBAR - [EMAIL PROTECTED] Up Beyond All Repair (or Recognition). 'foo', 'bar' is just a play on the original acronym - A

RE: Search Replace in multiple files

2004-02-06 Thread Charles K. Clarkson
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: : : I went through perldoc perlrun and saw the code. : : I thought it as a criminal waste of time to try and : modify that code for my purpose, when I can ask you : folks :-) Perhaps I am misunderstanding you, but that sounds to me like you would

RE: Search Replace in multiple files

2004-02-06 Thread Ned Cunningham
. Clarkson [mailto:[EMAIL PROTECTED] Sent: Friday, February 06, 2004 9:54 AM To: [EMAIL PROTECTED] Subject:RE: Search Replace in multiple files [EMAIL PROTECTED] [EMAIL PROTECTED] wrote

Re: Search Replace in multiple files

2004-02-06 Thread John W. Krahn
Chetak Sasalu wrote: Hi, Hello, I have to search and replace 'foo' to 'bar' in all the files in a directory(has subdirectories). The files are about 40k in size. On the command line I would do it as, find ./mydir/ -type f -print | xargs perl -pi -e 's/foo/bar/' No backup of the

Re: Search Replace in multiple files

2004-02-06 Thread R. Joseph Newton
Ned Cunningham wrote: Wouldn't it be better to not waste your time with this kind of response??? Ned Cunningham POS Systems Development Hi Ned, I'd say that it depends on whether you see the OP as a potential programmer. If so, then no, it would not be better. If the OP takes a hint and