Hi,
I am trying to insert text to the beginning of a text file with 'sed'. Its working however the new line is getting stripped.
I have a variable with the text that I want to insert:
VAR="This is the header line \n March 22, 2010 \n"
sed "1i\\
$VAR" logfile >tmpfile
The text gets inserted at the beginning of the file with no new line, just the 'n' with out the \.
# cat tmpfile
This is the header line n March 22, 2010 n
Is there a way to have the new line work here?
I am running on 5.0.7.
Thanks