sed

Stream editor

Usage: sed cmd [list-of-files]

Standard Input: Used only if no list-of-files is given

Standard Output: Used to display results

SEE ALSO

For more information, see page 526

Useful sed commands:

q means quit.

s means substitute.

Using sed from the command line to replace strings in output:

sed 's/R.E./repl/g' [list-of-files] sed 's:R.E.:repl:g' [list-of-files] # can change delimiter sed '5,23 s/R.E./repl/g'[list-of-files] only change lines 5 thru 23, $ means end of line sed '/acme/ s/R.E./repl/g' [list-of-files] only change lines that contain acme sed '/s1/,/s2/ s/R.E./repl/g' [list-of-files] only changes lines from first occurrence ...

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.