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 12-31-2008
foleyml foleyml is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 3
Grep Different Files Using a Loop?

I have a script to GREP for a text expression within certain files, the files being named file.11012008 thru file.11302008. 30 files in all, one for each day of the month.

Instead of entering the following 3 lines of code 30 different times, I'm trying to find a way to loop the process:

#insert the heading of the search
echo 11/01/2008 >> LOG_FILE

#insert blank line below the heading
echo "" >> LOG_FILE

#grep for the text and its entire line, then insert in log file.
grep "search_text" search/path/file.11012008 >> LOG_FILE

Thanks a million!