Greetings.
I'm simply attempting to insert a line of data into a text file at specific line.
Examples I've located elsewhere indicate the command should be something like this:
Entering the command as such results in:
Which indicates that I'm missing a slash or backslash perhaps?
I cannot seem to find a solution to this seemingly obvious problem on the forum or elsewhere.
The man page for sed indicates that syntax for the i command is [1addr]i\ but i cannot find any mention of closing the command before the file name.
This is my first post, I apologize in advance for my ignorance
I'm simply attempting to insert a line of data into a text file at specific line.
Examples I've located elsewhere indicate the command should be something like this:
sed -i '1i\testtext' temp.txt
Whereas this command would insert phrase testtext at line 1 of file temp.txt and....sed -i '2i\testtext' temp.txt
would insert phrase testtext at line 2 of file temp.txt.Entering the command as such results in:
sed: 1: "temp.txt": undefined label 'emp.txt'
Which indicates that I'm missing a slash or backslash perhaps?
I cannot seem to find a solution to this seemingly obvious problem on the forum or elsewhere.
The man page for sed indicates that syntax for the i command is [1addr]i\ but i cannot find any mention of closing the command before the file name.
This is my first post, I apologize in advance for my ignorance
