Hi experts,
I would like a favour from you guys to get the info from 5th column which was separated by the delimeter comma ( , )
The Data file is as below:-
1,USER1,"90, TEST AVENUE, OLD ROAD",test1,124,N
2,USER2,88 TEST STREET NEW ROAD,test2,123,N
The User File is as below:-
USER1
USER2
And my simple script is as below:-
while read i
do
5thCol=`grep ".,$i," $DATAFILE| cut -d"," -f5`
echo "$5thCol"
done < DATA.FILE
The output will be:-
OLD ROAD"
123
It's because of the commas in 3rd column which is "90, TEST AVENUE, OLD ROAD".
How can i get the correct output as below?
124
123
your help is much appreciated.
thanks