Hi,
For Example: I have one month files like from August 1 to August31.
I want to list only from August 1 to august 15 files.
Please advice.
Thanks,
Mani
Hi,
For Example: I have one month files like from August 1 to August31.
I want to list only from August 1 to august 15 files.
Please advice.
Thanks,
Mani
The following should work for the specific case you outline
ls $(for i in $(seq 1 15); do printf "August\ 2d" $i;done)
seq just provides a sequence
printf bears further study, as it allows you format your output quite flexibly.
CORRECTION Sorry reviewed your question and the space is present in all cases rather than just as padding.
you could get away with
ls $(for i in $(seq 1 15); do echo "August\ $i";done)
Do you mean that these files have such names or they were modified in this period?
Valid question from yazu, If this is the case, try running
ls -l| egrep '2011-08-(0[1-9]|1[0-5])'
Hello.
This is example
-rw-r--r-- 1 prodlog ccusrs 29055 Aug 31 01:56 EBDD_status.log_A_110830
-rw-r--r-- 1 prodlog ccusrs 61773 Aug 31 01:56 FUI_GSA.log_A_110830
-rw-r--r-- 1 prodlog ccusrs 5909 Aug 31 01:56 FUI_GSA.stats_A_110830
-rw-r--r-- 1 prodlog ccusrs 1792 Aug 31 01:56 GCSX.BROKER.GDS.RESEND.FEED.BACKOUT.log_A_110830
-rw-r--r-- 1 prodlog ccusrs 1897 Sep 1 01:57 svrMLIS_IRINFO.log_A_110831
-rw-r--r-- 1 prodlog ccusrs 3909 Sep 1 01:57 svrMLISreconc.log_A_110831
-rw-r--r-- 1 prodlog ccusrs 63621 Sep 1 01:58 FUI_GSA.log_B_110831
-rw-r--r-- 1 prodlog ccusrs 5352 Sep 1 01:58 FUI_GSA.stats_B_110831
-rw-r--r-- 1 prodlog ccusrs 117400 Sep 1 01:58 FUI_GSA.log_C_110831
-rw-r--r-- 1 prodlog ccusrs 28543 Sep 2 01:56 EBDD_status.log_A_110901
-rw-r--r-- 1 prodlog ccusrs 88904 Sep 2 01:56 FUI_GSA.log_A_110901
-rw-r--r-- 1 prodlog ccusrs 8080 Sep 2 01:56 FUI_GSA.stats_A_110901
-rw-r--r-- 1 prodlog ccusrs 83258 Sep 3 01:57 gsa.cleanup.stats_A_110902
-rw-r--r-- 1 prodlog ccusrs 15 Sep 3 01:57 in781117_20110805124231741371.gxd_A_110902
-rw-r--r-- 1 prodlog ccusrs 69455 Sep 3 01:57 recycle_combined.log_A_110902
-rw-r--r-- 1 prodlog ccusrs 314849 Sep 3 01:57 svrArchivingReceive.log_A_110902
-rw-r--r-- 1 prodlog ccusrs 734 Sep 4 01:56 DistributeEvent.stats_A_110903
-rw-r--r-- 1 prodlog ccusrs 21872 Sep 4 01:56 EBDD_status.log_A_110903
-rw-r--r-- 1 prodlog ccusrs 28641 Sep 4 01:56 FUI_GSA.log_A_110903
-rw-r--r-- 1 prodlog ccusrs 3909 Sep 4 01:56 FUI_GSA.stats_A_110903
Note: Please see above there are files availables under Aug 31,Sep 1,2,3,4
I want to list only for Aug31,Sep1,2,3. Not for Sep 4th.
I hope that will be clear
Thanks,
Mani
ls -l | egrep '(Aug[:space:]+31|Sep[:space:]+(1|2|3))'
$ ls -ltr | egrep "Aug [1-9]|Aug 1[0-5]"