|Just another Perl shrine|
Re: Search and replace in file (was Need help with string and file manipulation)by tachyon (Chancellor)
|on Apr 13, 2002 at 18:27 UTC||Need Help??|
A key element in learning is RESEARCH. All the answers you want are on this site, in problably 100+ threads. Here is how to find just one of them.....
There is a feature here called Super Search. You can search for different phrases. I might try 'search and replace in file', 'reading from a file', 'writing to a file' as search strings. The functions you will use are (in order):
You can do it in one line in Perl using the 'inplace editing' function. This will do the search and replace inplace on somefile.txt and write a backup of the original to somfile.txt.bak. Unfortunately you will probably get a FAIL if you submit it as your homework answer.