Given the filename is ended with ".txt",you may try this way. $ cd /your/dir $ perl -pi -nle 's/foo/bar/' *.txt
This will replace 'foo' with 'bar' in all *.txt file in current dir. Good luck. -----Original Message----- >From: Brad Grandorff <[EMAIL PROTECTED]> >Sent: Dec 14, 2006 8:58 AM >To: beginners@perl.org >Subject: Modify several files in a directory.... > >I have managed to get a one liner working for modifying a particular file in a >directory, and I have also used arrays to read in then modify a particular >file... >but I can't seem to do so using opendir and reading in several files at once... > >Basically I want to search several files within a directory for a particular >keyword, then replace that keyword with a user provided value.. > >I know it is pretty straightforward and simple... >Does anyone have any example scripts / code that I can look at? > > > > > >--------------------------------- >Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. -- Books below translated by me to Chinese. Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/ Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>