The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 09-05-2007
cbreiner cbreiner is offline
Registered User
 

Join Date: Aug 2007
Posts: 2
Search first line of compressed file

I want to read a directory full of compressed files and move the file to another directory if it meets certain criteria. I only want to look at the first line of the compressed file and if I find the string, do the move. I am currently using the following:

zgrep -R -L IH120070731/psoft/bnydata/etl/BNY_CRDW_UAT/source_archive/08012007 | xargs -i {} mv {} ../20070731/{}

This does fine and doesn't run too bad if most of the files will be moved. It takes forever for the zgrep to go through every line of every file when I really only want to check the first line.

Any ideas on how to limit the search to the first line only?

Thanks in advance.
Reply With Quote
Remove advertisements
!!
Forum Sponsor