Replacing string without opening the file - Linux Views : 323
Tagged in : Linux
0 0
Send mail
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.
By rajesh, On - 2009-11-10



    Login to add Comments .