Issue
I have a directory structure like /store/hour/
....
so example: london/04/
...
I want to do a day to date report, so say:
show me all directories where the hour is <10 for example
How would I do this in a single command?
Thanks
Solution
Supposing a /store/hour
structure with 2-digit hours, a simple way can be to filter them with egrep
:
Hour < 10:
ls -1d /* | egrep '^\/\w+\/0[0-9]$'
Hour < 15:
ls -1d /* | egrep '^\/\w+\/(0[0-9])|(1[0-4])$'
Answered By - cornuz