Replacing string without opening the file
by rajesh[ Edit ] 2009-11-10 12:38:43
We can replace the string in a file without opening it by using the string command
sed 's/old-string/new-string/g' filename
To move the string replaced output in to a new file
sed 's/cat/dog/g' filename > newfilename
So, the above code will replace cat with dog in the file named filename and save the result in newfilename.