Tutorial by Examples

Given a file file.txt with the following content: line 1 line 2 line 3 You can add a new line after first matching line with the a command. For portable use the a command must be followed immediately by an escaped newline, with the text-to-append on its own line or lines. sed ' /line 2/a\ ...

Page 1 of 1