5

What's the command to "prepend" a line to a file?

view full story
linux-howto

http://unix.stackexchange.com – Other than create a temporarily file with a line at the heading, and move it back when finished, is there a standard way to prepend some lines to a file? i.e sometimes you do (echo #GPL license; cat $file) > tmpfile; mv tmpfile $file EDIT And notice that the source to prepend might not just be a fixed string, it could be a file as well, i.e cat $header $file > tmpfile; mv tmpfile $file (HowTos)