Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi I have a list of file names

Status
Not open for further replies.

kaushik222

Technical User
Oct 23, 2003
26
0
0
US
Hi
I have a list of file names of flat feeds in a text file in the following format
filenames.txt
-----------------
file1.feed
file2.feed
file3.feed
file4.feed .........approx 25 filenames

these files exists in a perticular /SRCDIR...

"|" is the delimiter for each column in each one of these files

I need to search for the number of columns and rows in every feedfile.

But I do it manually by giving the columns less than some number and try to know it this way
awk 'BEGIN {FS=&quot;|&quot;} NF < 20' < FeedFileName | wc -l

Is there way, where it takes one filename at a time from filenames.txt and get the number of columns and rows, puts the output into one single file output file.


 
Try something like this:
Code:
awk -F'|' '{nf=0;nr=0;feed=&quot;/path/to/&quot;$1
while((getline <feed)>0){nf=NF;++nr}
close(feed);printf &quot;%s\t%d\t%d\n&quot;,feed,nf,nr
}' filenames.txt

Hope This Help
PH.
 
Hi PHV
thanks for the script, but it is not working
Anything with GETLINE is giving the following error

awk: syntax error near line 1
awk: illegal statement near line 1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top