Add a line to a specific position in a file using Linux sed

view story

http://garron.me – Add a line in a specific position with Linux If you need to add a line to a file in Linux, and you need to add that line in a specific position of the file there is an easy solution, even if you need to do it to hundreds of thousands of files. Consider this file: line 1 line 2 line 4 As you can see we missed line 3, so to add it just execute this command: sed '3iline 3' Parts of the command sed: is the command itself 3: is the line where you want the new line inserted i: is the parameter that says sed to insert the line. line 3: is the text to be added in that position. That wil (HowTos)