Monday, 29 December 2008

get the number of columns in the heading of a file

Number of fields or columns in the first line of a file

take a file menu.sh which is of content like this:

Name empid Salary role DOB

robin 2981 10000 Engineer 27-8-93

awk 'NR==1 {print NF}' menu.sh

No comments:

Post a Comment

Tweets by @sriramperumalla