Shanks
1
Hello ,
I am trying to replace a pattern in shell script , basically there is a file with the list of tables like
A.DAT
B.DAT
C.DAT ..
I will need to replace a prefix for the list
TESTA.DAT
TESTB.DAT
TESTC.DAT
Do I need to use <tr> or sed , I am not sure whether I need to use awk to get the print $1 , in my case it's always one string
Thanks,
awk '{ print "TEST" $0 }' < infile > outfile
$0 is a special variable in awk which means 'the entire line'.
Shanks
3
Thank you , this helps
If I have to include an variable which is populated in the Run time
like , for e-g
CCode='Google'
awk '{ print "TEST_$CCode" $0 }' < test > test1
Please advice
Thanks
awk -v VAR="stuff" '{ print VAR $0 }'
CCode='Google'
sed "s/^/${CCode}/" infile