How to insert some constant text at beginig of each line within a text file.

Dear Folks :),

I am new to UNIX scripting and I do not know how can I insert some text in the first column of a UNIX text file at command promtp.
I can do this in vi editor by using this command :g/^/s//BBB_

e,g I have a file named as Test.dat and it containins below text:

michal
David
Lisa
Antonio

Now I want to insert BBB at the beging of every line and out put should look like belwo:

BBB_michal
BBB_David
BBB_Lisa
BBB_Antonio

Is there are way by using sed, awk or any other command I can get the above out put file. I want to run this command at UNIX command prompt.

Please advice & your feed back is highly appreciated.

Many thanks

Kind Regards

M.Afzal

yes, if your file is line sequential file
you can use awk
awk ' { print "BBB_" $0 } ' yourfilename > outputfilename

Dear Paresh,

You command works very fine, its perfect and you are really intelligent.

Many thanks,

Kind Regards,

Muhammad Afzal

Alternative...

(04:35:36\[ddeco***@S.ManDNCS)
[~]$ cat test
michal
David
Lisa
Antonio

(04:35:36\[ddeco***@S.ManDNCS)
[~]$  sed 's/^/BBB_/g' test
BBB_michal
BBB_David
BBB_Lisa
BBB_Antonio

PS: Whats up fellow (former) DTVer

sed 's/^/BBC_/' file