February 2004
Beginner
204 pages
5h 40m
English
Like awk, sed is a pattern-matching engine that can perform manipulations on lines of text. Its syntax is closely related to that of vim and the line editor ed. Here are some trivial examples.
Print the file with all occurrences of the string “red” changed to “hat”:
$ sed 's/red/hat/g' myfile
Print the file with the first 10 lines removed:
$ sed '1,10d' myfile
Read now
Unlock full access