sunny82
asked on
Calculating no. of columns in a flat file
Hi,
I want to find out the no. of columns in a flat file. If it is "," delimited, I am using
awk -F\\, '{print NF;exit}' filename.txt
which is giving me correct results.
But the delimiter can be either comma or pipe delimited. How can I make that provision in Unix?
I want to find out the no. of columns in a flat file. If it is "," delimited, I am using
awk -F\\, '{print NF;exit}' filename.txt
which is giving me correct results.
But the delimiter can be either comma or pipe delimited. How can I make that provision in Unix?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER