Hi All,
I need to find last two files for the month.
lets say there are following files in directory
-rwxr-xr-x 1 user userg 1596 Mar 19 15:43 c.txt
-rwxr-xr-x 1 user userg 1596 Mar 21 15:43 d.txt
-rwxr-xr-x 1 user userg 1596 Mar 22 15:43 f.txt
-rwxr-xr-x 1 user userg 1596 Mar 24 15:43 h.txt
-rwxr-xr-x 1 user userg 1596 Mar 25 15:43 w.txt
-rwxr-xr-x 1 user userg 1596 Feb 12 15:43 q.txt
-rwxr-xr-x 1 user userg 1596 Feb 21 15:43 a.txt
-rwxr-xr-x 1 user userg 1596 Feb 22 15:43 s.txt
-rwxr-xr-x 1 user userg 1596 Feb 23 15:43 k.txt
-rwxr-xr-x 1 user userg 1596 Feb 27 15:43 j.txt
output should be:
Mar 24 15:43 h.txt
Mar 25 15:43 w.txt
Feb 23 15:43 k.txt
Feb 27 15:43 j.txt
Thanks a lot Srini & Rudic
Actualy i want all files other than last two files per month.
can it be posibble?
-rwxr-xr-x 1 user userg 1596 Mar 19 15:43 c.txt
-rwxr-xr-x 1 user userg 1596 Mar 21 15:43 d.txt
-rwxr-xr-x 1 user userg 1596 Mar 22 15:43 f.txt
-rwxr-xr-x 1 user userg 1596 Mar 24 15:43 h.txt
-rwxr-xr-x 1 user userg 1596 Mar 25 15:43 w.txt
-rwxr-xr-x 1 user userg 1596 Feb 12 15:43 q.txt
-rwxr-xr-x 1 user userg 1596 Feb 21 15:43 a.txt
-rwxr-xr-x 1 user userg 1596 Feb 22 15:43 s.txt
-rwxr-xr-x 1 user userg 1596 Feb 23 15:43 k.txt
-rwxr-xr-x 1 user userg 1596 Feb 27 15:43 j.txt
output should be:
c.txtd.txtf.txtq.txta.txts.txt
---------- Post updated at 09:35 AM ---------- Previous update was at 09:32 AM ----------
-rwxr-xr-x 1 user userg 1596 Mar 19 15:43 c.txt
-rwxr-xr-x 1 user userg 1596 Mar 21 15:43 d.txt
-rwxr-xr-x 1 user userg 1596 Mar 22 15:43 f.txt
-rwxr-xr-x 1 user userg 1596 Mar 24 15:43 h.txt
-rwxr-xr-x 1 user userg 1596 Mar 25 15:43 w.txt
-rwxr-xr-x 1 user userg 1596 Feb 12 15:43 q.txt
-rwxr-xr-x 1 user userg 1596 Feb 21 15:43 a.txt
-rwxr-xr-x 1 user userg 1596 Feb 22 15:43 s.txt
-rwxr-xr-x 1 user userg 1596 Feb 23 15:43 k.txt
-rwxr-xr-x 1 user userg 1596 Feb 27 15:43 j.txt
output should be:
Code:
For Marc.txtd.txtf.txtfor Febq.txta.txts.txt
Hi All,
I need to find all files other than last two files per month.
lets say there are following files in directory
Mar 19 15:43 c.txt
Mar 21 15:43 d.txt
Mar 22 15:43 f.txt
Mar 24 15:43 h.txt
Mar 25 15:43 w.txt
Feb 12 15:43 q.txt
Feb 21 15:43 a.txt
Feb 22 15:43 s.txt
Feb 23 15:43 k.txt
Feb 27 15:43 j.txt
output should be:
Mar 19 15:43 c.txt
Mar 21 15:43 d.txt
Mar 22 15:43 f.txt
Feb 12 15:43 q.txt
Feb 21 15:43 a.txt
Feb 22 15:43 s.txt
Post #1 states that you only want to keep the last two files of each month.
Posts #5 and #7 indicate the inverse: the last two files of each month should be discarded.
Now, with post #13, you present a third permutation which appears to require keeping all files except those whose dates match the first 2 days of the month and the last day of the month.
If you want volunteers to help you freely, the least you can do is present a single, coherent problem statement. Speaking for myself, you're not paying me enough to track this moving target.
Appologies Alister.I am very new to this forum.Please bare with me.
My final problem statement as follows:
I need to find all files other than first two files dates & last file date for month and month/year wise list.
lets say there are following files in directory
Mar 19 2012 c.txt
Mar 19 2012 cc.txt
Mar 21 2012 d.txt
Mar 22 2012 f.txt
Mar 24 2012 h.txt
Mar 25 2012 w.txt
Feb 12 2012 q.txt
Feb 21 2012 a.txt
Feb 21 2012 aa.txt
Feb 22 2012 s.txt
Feb 23 2012 k.txt
Feb 27 2012 j.txt
Mar 19 15:43 c.txt
Mar 21 15:43 d.txt
Mar 22 15:43 f.txt
Mar 24 15:43 h.txt
Mar 25 15:43 w.txt
Mar 25 15:43 ww.txt
Feb 12 15:43 q.txt
Feb 21 15:43 a.txt
Feb 22 15:43 s.txt
Feb 23 15:43 k.txt
Feb 27 15:43 j.txt
Feb 27 15:43 jj.txt
output should be:
#for Mar 2012
Mar 22 2012 f.txt
Mar 24 2012 h.txt
#for Feb 2012
Feb 22 2012 s.txt
Feb 23 2012 k.txt
#for Mar 2014
Mar 22 15:43 f.txt
Mar 24 15:43 h.txt
#for Feb 2014
Feb 22 15:43 s.txt
Feb 23 15:43 k.txt