AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
Expand all | Collapse all

Commands to grep different dates of the month

  • 1.  Commands to grep different dates of the month

    Posted Fri February 05, 2010 03:34 AM

    Originally posted by: aravinthsamy


    Some commands to grep different dates of the month

    ls -ltr | grep "Jan 20-7" -----to list the files from jan20 to jan27
    ls -ltr | egrep "Oct (10-7|20-2|25)" ----------To list the files from 10-17, 20-22, and 25th of Oct month
    ls -ltr | egrep "((Oct|Dec) (10-7|20-7))"--------To list the files of both month Oct and Dec from 10th to 17th and 20th to 27th
    ls -ltr | egrep "((Oct|Dec) (10-7|20-2|25))" --------To list the files of both month Oct and Dec from (10th to 17th) and (20th to 22nd) and 25th
    ls -ltr | egrep "((Oct|Dec) (10|20|26|28))" -----------To list the files of both month Oct and Dec grepping date of 10th,20th,26th,28th
    ls -ltr | egrep "((Sep|Oct|Dec) (10|20|26|28))" -----------To list for 3 months similarly like above
    ls -ltr | egrep "(Oct (10-7|20-2|25)| Dec (12-5|23-6|29))"--------To list the files of (Oct 10-17,20-22,25) and (Dec 12-15,23-26,29)
    #AIX-Forum


  • 2.  Re: Commands to grep different dates of the month

    Posted Fri February 05, 2010 03:56 AM

    Originally posted by: aravinthsamy


    In the above 20-7=====> 0 - 7 comes in square brackets, brackets applicable similarly for all the above underlined
    #AIX-Forum