I want to add a line on top of say f1 file using awk.Is there a better way than the following?
f1
awk 'BEGIN{print "word"};{print $0}' f1 > aux;cp aux f1;\rm aux<br/>
Does awk have something like the -i option in sed?
-i
Why not use sed - it would make the solution simpler
$sed -i.bak '1i\ word ' <filename>
An alternative way to do this:
sed -i '1s:^: Word1\nWord2 :' file