I have a script which retrieves certain fields from a text file using awk. The delimiter used is white space.
cat /home/eis/boss/OPS|while read LINE
do
crdno=`echo $LINE | awk '{print $1}'`
atm=`echo $LINE | awk '{print $2}'`
seq=`echo $LINE | awk '{print $3}'`
amount=`echo $LINE | awk '{print $8}'`
rec=`echo "CARD NO:$crdno ATM ID:$atm AMOUNT:$amount SEQ:$seq"`
done
Problem now is that we have a new field added in the text file which has to be retrieved. This field has addresses as values and as such there are white spaces in this field in the addresses. The address field starts at position no. 8 and is the last field as such but due to the white spaces between the values in this field I cannot retrieve the 8th Field without losing out some portion of values due to the white space between them.
eg:
FIELD1 FIELD2 FIELD3 FIELD8
a 21 400 EVERGLADES 20/A
b 22 5000 FLIPSYDE-REGION
c 23 650 GREEN DAY ROCKS
I need to retrieve from the 8th Field to whatever is the last field. Any suggestions on the same ??
Regds,
Jobby