Tuesday 6 August 2019

SED: how to add a line at the top of files


Imagine, you have a set of ReST files, and you want to add the statement “author: your name” at the top of each of them. First, identify the files you want to edit and pipe them to sed:
Where ‘1i’ means insert on the first line. Note also that you must replace sed -e by sed -i -e to replace the file content, otherwise it is like a dry run.

0 comments:

Post a Comment