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-29-2007
scabral scabral is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 2
grep for date in file

Hi,

i have a script that stores the date in a variable as follows:

DATESTAMP=`date +"%m%d%Y"`

I also have another file called HOLIDAYFILE which stores all of our holidays as follows:

01/01/2007
07/04/2007

What i need to do is use the grep statement in my script to see if DATESTAMP is in the HOLIDAYFILE and store that in another variable, let's say HOLIDAY, and if HOLIDAY has a value then do nothing and exit the script, otherwise proceed with the code.

anyone have a good grep statement that would do this?

thanks
scott