Wednesday, November 18, 2015

Edit a file directly using "sed" command in Linux


sed is stream editor, but can edit files directly

sed -i -e 's/foo/bar/g' hello.txt
 
s is used to replace the found expression "foo" with "bar" and g used to

replace any found matches.

-i option is used to edit in place on hello.txt.

-e option indicates a command to run.


No comments:

Post a Comment

jq command in Linux

 How to access the {"field-name":"cskmetro"} echo "{\"field-name\":\"cskmetro\"}" |jq -r ...