Hi,
Please suggest me to write unix command, HEADER20110101 string append to first line of a file..
Regards
Akshu
Hi,
Please suggest me to write unix command, HEADER20110101 string append to first line of a file..
Regards
Akshu
i am adding 123 in the first line of the file called test
$ nawk ' { if (NR==1){printf("123%s\n",$0)} else {print} }' test
123abc
abc
abc
abc
abc
$ cat test
abc
abc
abc
abc
abc
---------- Post updated at 11:50 AM ---------- Previous update was at 11:48 AM ----------
using sed
$ sed ' 1 s/.*/123&/' test
123abc
abc
abc
abc
abc
Alternate awk..
awk 'NR==1{$0="header\n"$0}1' inputfile
Hi,
Try this:
sed -i '1s/.*/ HEADER20110101&/' a.txt