linux - awk save modifications in place -


i learning awk , know if there option write changes file, similar sed use -i option save modifications file.

i understand use redirection write changes. there option in awk that?

in latest gnu awk (since 4.1.0 released), has option of "inplace" file editing:

[...] "inplace" extension, built using new facility, can used simulate gnu "sed -i" feature. [...]

example usage:

$ gawk -i inplace '{ gsub(/foo/, "bar") }; { print }' file1 file2 file3 

to keep backup:

$ gawk -i inplace -v inplace_suffix=.bak '{ gsub(/foo/, "bar") } > { print }' file1 file2 file3 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

html - Building a fluid horizontal navigation -