Hello,
I am new to this forum. I have a question in Unix shell scripting. Here is my requirement
I have 1000 files and I need to insert a header with one line at the top of each of the 1000 files. Please let me know if you have any solution for this
Thanks in advance.
Raj
perl -i -0pe '$_="header\n" . $_' *
suppose all files in one directory (not tested but should work) : HEADER="--- This is the header --- " for F in * do echo "$HEADER$(cat $F)" > $F done
$ ruby -i.bak -pe '$_="text\n#{$_}" if $.==1' file $ sed -i '1 i text' file
######## This match to you requirement perfectly######## HEADER="This is the header line"
for F in \* do echo "$HEADER\\n$\(cat $F\)" > $F done