Search code examples
regexlinuxgrepfile-search

Having trouble with GREP and REGEX


I have a text file that stores combinations of four numbers in the following format:

Num1,Num2,Num3,Num4
Num5,Num6,Num7,Num8
.............

I have a whole bunch of such files and what I need is to grep for all filenames that contains the pattern described above.

I constructed my grep as follows:

grep -l "{d+},{d+},{d+},{d+}" /some/path/to/file/name

The grep terminates without returning anything.

Can somebody point out what I might be doing wrong with my grep statement?

Thanks


Solution

  • This should do what you want:

    egrep -l '[[:digit:]]+,[[:digit:]]+,[[:digit:]]+,[[:digit:]]+' /some/path/to/file/name