I am trying to insert a line in the beginning of a file using sed. I tried below commands :
sed -i '1s/^/LINE TO INSERT\n/' test.txt
sed: illegal option -- i
--> Error thrown
sed '1i/^/LINE TO INSERT\n/' test.txt
sed: Function 1i/^/LINE TO INSERT\n/ cannot be parsed.
--> Error thrown
Both the ways came out to be failed.
Any possible solution to it ? I am using ksh
script on HP-UX.
Thanks.