I've got a directory that contains hundreds of sub-directories that all have dates as their names, and inside each of those sub-directories, there's a bunch of files I need to be searching through. The grep command I'm using right now is this:
grep -ER --exclude-dir=2017060200_it2 "PATTERN" *_it2/file00*.pjson
and the folder structure looks like this:
parcel/ |--- 2015010100_it2/ |--- file001.pjson |--- file002.pjson ... |--- file005.pjson |--- 2015010200_it2/ |--- file001.pjson ... ... |--- 2017060200_it2/ |--- file001.pjson |--- file002.pjson ...
I want my grep command to be searching in
file00*.pjson for every single sub-directory EXCEPT the most recent one, in this case being
2017060200_it2. However, my
--exclude-dir=2017060200 doesn't seem to be accomplishing this.
I'm using grep V2.20 on a CentOS 6.7 system, and when I use
grep --help, I do get the option for using
--exclude-dir, so I don't think this information is relevant.
Bonus: If you could show me how to get the current date and format it as
yyyyMMdd00_it2 so that I could make this a cron job, that would be awesome, but I was planning on figuring out how to do that separately once I got this working.