0

My sample file has several lines like this

27809, shbd.dav, 165 .
27673 ; matroshka;  223665;

I need to count the lines containing digits. So the output should be 2.

I only have to use grep to do this.

αғsнιη
  • 41,407

1 Answers1

4

Try this:

grep -c '[[:digit:]]' infile

replace [[:digit:]] with [0123456789] if you want restrict digits to only English digits (see Difference between [0-9], [[:digit:]] and \d).

αғsнιη
  • 41,407