Hello!
I have 2 files named tacs.tmp and tacDB.txt
tacs.tmp looks like this
0
10235647
102700
106800
107200
1105700
tacDB.txt looks like this
100100,Mitsubishi,G410,Handheld,,0,0,0
100200,Siemens,A53,Handheld,,0,0,0
100300,Sony Ericsson,TBD (AAB-1880030-BV),Handheld,,0,0,0
100400,Nokia,RM-669,Handheld,,0,0,0
100500,Motorola,M930 NA DB,Handheld,,0,0,0
100600,Panasonic,EBX700,Handheld,,0,0,0
100700,Sagem,Test IMEI,Handheld,,0,0,0
100800,Philips,TCD718,Handheld,,0,0,0
I'm trying to grep the TAC from tacs.tmp in tacDB.csv as follows:
cat tacs.tmp | while read TAC
do
echo $TAC,`grep $TAC tacDB.txt` >> taclookup.csv
done
The problem with that is that that TAC
102700
matches with
102700, 1027000, 1027001, 1027002, 1027003, 1027004
and so on.
I tried to use the following but it only returns the output at the bottom:
cat tacs.tmp | while read TAC
do
echo $TAC,`egrep \<$TAC\> tacDB.txt` >> taclookup.csv
done
102700,
106800,
107200,
1105700,
1118600,
1135900,
11442570,
1155900,
1186100,
1187000,
Finally, my desired output should be along the lines of this:
100200,100200,Siemens,A53,Handheld,,0,0,0
100300,100300,Sony Ericsson,TBD (AAB-1880030-BV),Handheld,,0,0,0
100400,100400,Nokia,RM-669,Handheld,,0,0,0
100500,100500,Motorola,M930 NA DB,Handheld,,0,0,0
100600,100600,Panasonic,EBX700,Handheld,,0,0,0
100700,100700,Sagem,Test IMEI,Handheld,,0,0,0
100800,100800,Philips,TCD718,Handheld,,0,0,0
I'm afraid my knowledge is limited to cat/grep etc. Any pointers would be appreciated.
Thanks
cludgie