perl -ne "s/TOTAL/T.TOT/g; print" test.txt > test1.txt it will pipe output into a new file called test1.txt. granted not exactly what you wanted but *is* one line.
cheers toby > -----Original Message----- > From: Allegakoen, Justin Devanandan > [mailto:justin.devanandan.allegakoen@;intel.com] > Sent: Thursday, November 07, 2002 5:00 PM > To: [EMAIL PROTECTED] > Subject: RE: Search and replace > > > > --------------------8<------------------------------------------- > I am looking to search and replace a pattern within a > file(not on command > line). That is, I have a file name within the Perl script and > I need to > search for a pattern and replace the same. > > Eg. search for the pattern TOTAL and replace with T.TOT > > Can I do this in a single statement ? That is without doing a > "open" command > on the file and then looking for the above pattern > line-by-line or a whole > array and then outputting the replaced pattern into a new file name ? > Is there something like "sed" in Perl ? > --------------------8<------------------------------------------- > > Bottom line is no. You should read up on perlfaq5: > "How do I change one line in a file/delete a line > in a file/insert a line in the middle of a file/append to > the beginning of a file?" > _______________________________________________ > Perl-Win32-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs