I wrote a bash search script that creates a directory named after the search
word and greps all the files and copies the ones that match to the new
directory and generates a printed output of the file. To make a very long
story short I have about 150 more searches to perform and each one takes
between 10 and 15 mins searching over 12,000 files. This is the first bash
script I have evr written and I am sure it could be done better but it works
for me for now. What I really need is a quick and dirty way for the script
to pull the search words from a list so that I can go home tonight :)

The script is as follows:
======================================================
# /bin/bash
mkdir ../success/"$1"
echo "" > ../success/"$1"/"$1_success"
echo "###################################################" >
../success/"$1"/"$1_success"
echo "###################################################" >>
../success/"$1"/"$1_success"
echo "Files that contain the search string $1" >>
../success/"$1"/"$1_success"
echo "###################################################" >>
../success/"$1"/"$1_success"
echo "###################################################" >>
../success/"$1"/"$1_success"
echo "" >> ../success/"$1"/"$1_success"
grep -l "$1" dump1* >> ../success/"$1"/"$1_success"
grep -l "$1" dump2* >> ../success/"$1"/"$1_success"
grep -l "$1" dump3* >> ../success/"$1"/"$1_success"
grep -l "$1" dump4* >> ../success/"$1"/"$1_success"
grep -l "$1" dump5* >> ../success/"$1"/"$1_success"
grep -l "$1" dump6* >> ../success/"$1"/"$1_success"
grep -l "$1" dump7* >> ../success/"$1"/"$1_success"
grep -l "$1" dump8* >> ../success/"$1"/"$1_success"
grep -l "$1" dump9* >> ../success/"$1"/"$1_success"
grep -l "$1" plow* >> ../success/"$1"/"$1_success"
grep -l "$1" excel* >> ../success/"$1"/"$1_success"
cp $(cat ../success/"$1"/"$1_success") ../success/"$1"
lpr -PBrother ../success/"$1"/"$1_success"

========================================================

As you can see it is envoved by ./scriptname searchword

I would like to do it by ./scriptname searchlist

Could some one point me to a quick way to do this so I can get the heck out
of here?

A million TIA

Steve


Reply via email to