Is there a way to modify a file without writing the contents to another file, without sed
and awk
?
For example:
$ cat test.txt
aaa
aaa
bbb
ccc
ddd
Replacing using sed
with -i
option, sed -i 's/aaa/NNN/g' test.txt
will produce the following:
NNN
NNN
bbb
ccc
ddd
How to do that without awk
and sed
?
sed -i
internally writes to a temporary file and then moves it into the place of the original file. The option title--in-place
is a little misleading. – Sebastian Nov 05 '14 at 09:34