|
|
Replacing string without opening the file - Linux
|
Views : 323
|
|
Tagged in : Linux
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
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 |
|
|
|