Hi,
Can anyone please give me the grep command to find all the lines in a file
that exceed 80 columns
Thanks,
gubbala
Hi,
Can anyone please give me the grep command to find all the lines in a file
that exceed 80 columns
Thanks,
gubbala
awk -F<delimiter> ' NF > 80 { print } ' filename
or just this
awk -F<delimiter> ' NF > 80 ' filename
sed -n '/\(.\)\{80\}/p' filename
This commands works out for 80 chars length of a line
and the OP had requested for lines greater than 80 columns !
Hi Matrixmadhan,
Have a look at this..It works well when I tested..
u142115@linux2alm:~/aps/aps4/product/den/dennis/test> awk '{print length($0)" "$0}' ne
36 gagkasdadsgfkdaskdgkagsdkgkasgdkgasd
8 assddasd
4 aaas
4 sddd
6 asasas
5 asddd
2 sa
9 saddasdas
2 sd
u142115@linux2alm:~/aps/aps4/product/den/dennis/test> sed -n '/\(.\)\{5\}/p' ne
gagkasdadsgfkdaskdgkagsdkgkasgdkgasd
assddasd
asasas
asddd
saddasdas
u142115@linux2alm:~/aps/aps4/product/den/dennis/test>
advise me if something wrong here...as I am a newbie in Unix..
with GNU grep
grep '.\{80,\}' file
Well possibly I could be wrong!
Meaning of columns is ambiguous here
What i meant is,
c1 <delimiter> c2 <delimiter> c3 ... <cn>
literal meaning of column as such being delimited by some delimiter ( including the default delimiter as well )
Its OP who should correct us, giving the meaning of columns here,
whether is 80 chars in a line or
columns as I had said .
Till OP clears it, I had to get back my statement that your command is wrong.
Am sorry about that !
If by columns you mean characters:
grep '.\{81\}' filename
Or:
awk 'length($0) > 80' filename
If you mean fields (adjust FS to the appropriate regexp if necessary):
awk 'NF > 80' filename
could be just,
awk 'length > 80' filename