The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-26-2009
nomkev nomkev is offline
Registered User
  
 

Join Date: May 2009
Posts: 6
any way to squish several date options into one line?

this obviously isnt overly important, but its a bit slow and i was wondering if i could prevent it from re-searching the file several times. i want my matches from the previous and coming three days, as well as today. this is what i have but its weighty and im having trouble finding a way to slim it down.

cd ~/work
grep -iT `date --date="3 days ago" "+%b%d"` les
grep -iT `date --date="2 days ago" "+%b%d"` les
grep -iT `date --date="1 days ago" "+%b%d"` les
grep -iT `date "+%b%d"` les
grep -iT `date --date="next day" "+%b%d"` les
grep -iT `date --date="2 days" "+%b%d"` les
grep -iT `date --date="3 days" "+%b%d"` les

just need to spit out the lines starting with mmmdd, and im hoping to save some space/time.
thanks
nomkev