I have a directory (Linux / Unix) on an Apache server with a lot of subdirectories containing many files like this:
- Dir
- 2010_01 /
- 142_78596_101_322.pdf
- 12_10.pdf
- ...
- 2010_02 /
- ...
How can I find all files with file names that look like this *_*_*_*.pdf:? where * is always a number!
I am trying to solve this as follows:
ls -1Rl 2010-01 | grep -i '\(\d)+[_](\d)+[_](\d)+[_](\d)+[.](pdf)$' | wc -l
But regex \(\d)+[_](\d)+[_](\d)+[_](\d)+[.](pdf)$doesn't work with grep.
Change 1 . Try ls -l 2010-03 | grep -E '(\d+_){3}\d+\.pdf' | wc -l, for example, just returning null. So it works great
source
share