replacing string within same file
Hi,
I want to write a script in ksh, which parses the file and replaces string within it (not writing the changed text to another file). I am able to write to another file, but don't know how to make changes within the file which is read. |
This is exactly what sed specializes in.
Code:
sed -i 's/original string/replacement string/' filename.ext man sed --- rod. |
or perl
perl -pi.bak -e 's/THIS/THAT/g' file ... this creates a .bak of the original (omit when script is proven if you prefer) |
All times are GMT -5. The time now is 08:10 PM. |