The sed
utility can be used to print the contents of a
file, substitute a line (or multiple lines), and then save the file. In
contrast to grep
, sed
can substitute a line or multiple lines in a file and perform an in-place update of that file.
The simplest sed
invocation when substituting foo
for bar
is:
$ sed 's/foo/bar/' inputfile
Continue reading “Manipulating text with sed”