Pages

Wednesday, August 19, 2020

SHELL: Add a line to a file

 If we want to add a line to a file as specific place, please use this command,


sed -i '1i Inserting at First Line' sample.txt
sed -i '4i "Inserting" : "At Fourth Line" ' sample.txt
With these commands we can insert the mentioned parameter at the mentioned line on the original file

No comments:

Post a Comment