Insert a line at specific line number with sed or awk

awksed

I have a script file which I need to modify with another script to insert a text at the 8th line.

String to insert: Project_Name=sowstest, into a file called start.

I tried to use awk and sed, but my command is getting garbled.

Best Answer

sed -i '8i This is Line 8' FILE

inserts at line 8

This is Line 8

into file FILE

-i does the modification directly to file FILE, no output to stdout, as mentioned in the comments by glenn jackman.