Dear All ,
I have the query
cat temp.txt
|28-07-1997|IF_LEG_DCCT|TOV JV sdfsdfdsfdsfdsCLOSED* KIEV|381015280
I need to count the number of fields in this pipe-seperated file. I beleive this is possible via AWK command.
The in above file, output of the count should be 5....
Can some-one please help me with this
Thanks
Suresh
Hii..
It is still not giving me correct results
$ cat temp.txt
|05-12-2003|IF_LEG_ACCT|TOV FOREST ...CLOSED... UA|966423631|Delete|||||N||||||Y|TOV FOREST ...CLOSED... UA|IEV Ukraine Sales UA|||UAA9664236310|UACO9664236310|06-04-2005||||IEV||UASLQ|1-2FSYM-240|06-09-2007||||||||||||LA|JHP UA|IF_LEG_ACCT
|28-07-1997|IF_LEG_ACCT|TOV JV KIEV|381015280|Delete|||||N||||||Y|TOV JV PARMATSIYA UKRAINE *CLOSED* KIEV|IEV Ukraine Sales UA|||UAA3810152800|UACO3810152800|27-06-2001||||IEV|UUU|UASLQ|1-2FM9I-391|05-09-2007||||||||||||UA|JHP PA|IF_LEG_ACCT
$ awk '{ print NF+1 }' temp.txt
12
16
Can you please advice
Regards
Suresh
matrixmadhan:
awk '{ print NF+1 }'
Friend this is taking space as the field separator, I the what he want is '|' as field seperator.
Oops..Got it now..Thanks a LOTT friends
Regards
Suresh