Say I have a large file with many rows and many columns. I\'d like to find out how many rows and columns I have using bash.
Following code will do the job and will allow you to specify field delimiter. This is especially useful for files containing more than 20k lines.
awk 'BEGIN {
FS="|";
min=10000;
}
{
if( NF > max ) max = NF;
if( NF < min ) min = NF;
}
END {
print "Max=" max;
print "Min=" min;
} ' myPipeDelimitedFile.dat