websolaris
Technical User
Hi all,
Newbie to the programming world and would like some help on something. Can this be done in awk or would I use some other language.
I have 2 files fileA and fileB
fileA has data:
B5432CB: file1234.us
B5643CB: file1234.bk
fileB has data:
file1234.us:::uka:ttk:
file1234.bk:::cbk:kkt:
Output file would look like this:
file1234.us:::uka:ttk:B5432CB:
file1234.bk:::cbk:kkt:B5643CB:
1. I don't want B5432CB: to be appended to same line everytime I run this.
2. The B5432CB: will be populated into field 6 everytime I run this.
Any suggestions will be grateful. This is what I have so far:
for row in `cat fileB`
do
filename=`echo $row |cut -d: -f1`
jcl=`grep -i $filename fileA`
jcljobname=`echo $jcl | awk '{print $1}'`
echo "$row$jcljobname" >> prod
done
This only works if I run the script with original fileB with no appends from previous runs.
Thank you.
Newbie to the programming world and would like some help on something. Can this be done in awk or would I use some other language.
I have 2 files fileA and fileB
fileA has data:
B5432CB: file1234.us
B5643CB: file1234.bk
fileB has data:
file1234.us:::uka:ttk:
file1234.bk:::cbk:kkt:
Output file would look like this:
file1234.us:::uka:ttk:B5432CB:
file1234.bk:::cbk:kkt:B5643CB:
1. I don't want B5432CB: to be appended to same line everytime I run this.
2. The B5432CB: will be populated into field 6 everytime I run this.
Any suggestions will be grateful. This is what I have so far:
for row in `cat fileB`
do
filename=`echo $row |cut -d: -f1`
jcl=`grep -i $filename fileA`
jcljobname=`echo $jcl | awk '{print $1}'`
echo "$row$jcljobname" >> prod
done
This only works if I run the script with original fileB with no appends from previous runs.
Thank you.