I want to replace the 2nd line of a file using linux sed using these following commands.
sed -i"" '2d' /usr/local/services/status.sh
sed -i '2i\testing' /usr/local/services/status.sh
Is there any error in my command? I can’t find out.
Is there any other way to do it?
Any kind of help is appreciated.
To replace 2nd line:
To insert before the 2nd line:
To use a variable as part of subtitution: