How do you add a line at the end of a file in Linux using SED?

Mỹ An

New member
How do you add a line at the end of a file in Linux using SED?
Answer
sed – Appending Lines to a File
  1. Append a line after ‘N’th line. This will add a line after ‘N’th line in the FILE. txt . Syntax: …
  2. Append Line using Regular Expression/Pattern. This will append the line after the line where pattern match is found. Syntax: sed ‘/PATTERN/ a <LINE-TO-BE-ADDED>’ FILE.txt Example:
 

Tìm kiếm

Back
Top