What does the 'i' command in 'sed' stand for?

The 'i' command in sed stands for "insert." It is used to insert text before a specified line in the input. The basic syntax is:

sed 'line_number i\
text to insert' file.txt

For example, to insert "Hello, World!" before line 3 of file.txt, you would use:

sed '3 i\
Hello, World!' file.txt

This command will add the specified text before the indicated line number in the output.

0 Comments

no data
Be the first to share your comment!