sed is a command-line utility in Linux and Unix systems that is used for text processing. It is particularly useful for performing basic text transformations on an input file, such as substitution, deletion and addition of text.

The basic syntax for sed is:

sed 'command' inputfile

Where command is the command to be executed on the inputfile

Examples:

Replace all occurrences of the word “pc” with “mac”:

sed 's/pc/mac/g' inputfile

Delete all lines that contain the word “mac”:

sed '/mac/d' inputfile

Insert the text “Hello, world!” at the beginning of each line:

sed 's/^/Hello, world! /' inputfile

Print only the lines from 2 to 5

sed -n '2,5p' inputfile

Substitute the word “pc” with “mac” only on the first line

sed '1 s/pc/mac/' inputfile

sed is a very powerful command that can be used to perform various text transformations. It can also use regular expressions for more advanced text processing.