1.

Explain the usage of SED command with examples?

Answer»

SED COMMAND in UNIX stands for stream editor, which is used to make changes to FILE content.

It can be used to find and replace strings or patterns without OPENING a file

The default behavior is that  the SED command REPLACES the first occurrence of a pattern in each and it won’t replace the second, third or multiple occurrence in the line.

If we use the ‘g’ option ALONG with the above command then SED command will replace all Unix strings with Linux globally ( g stands for globally) .

sed 's/unix/linux/g' sample.txt


Discussion

No Comment Found