in reply to insert into beginning of file
I mentioned this before here.
This will add text to the beginning of temp.txt and back up the current contents of temp.txt to temp.txt.bak
perl -pi.bak -e 'unless ($notfirst++){print "text to add\n";}' temp.t +xt
--
flounder
|
|---|