[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding file with specific Text string



On Fri, Apr 04, 2003 at 06:41:26AM -0600, Doug Wyman wrote:
> Finding file with specific Text string
> 
> I am using Red Hat 7.3 and have not figured out the command line that 
> will give me the output that I'm looking for.  I would like to get 
> the document names where a specific text string exist.  
> 
> The files are Microsoft Word documents on a CD.  They are daily and 
> shift log files.  I need to find which documents has the specific 
> text string “LSTMIS1” in it.  The documents are arranged in 
> directorys by year, then by month under that. Each shift makes a file 
> everyday. 
> 

this is the text string you would find if you used vi on the word doc, or
is this the text string if you open the file in openoffice (or kword etc.)?

ok this is just a quick and dirty script, you could prolly do better with
a little perl or something, email me off list when you get a chance
script:

#!/bin/bash
#first lets get a file list to work with
#this assumes your files are located in /home/castlebb/logfiles
#directory and that your 2001 etc. dirs are underneath
files=`find /home/castlebb/logfiles/`
#now for each of these files we want to do stuff, thus the for loop

for file in $files ; do
# testing to make sure we aren't trying to grep a dir
        if [ -f "$file" ] ; then
        grep -H "\&\#8220\;LSTMIS1\&\#8221\;" $file >> /home/castlebb/logcheck1
        fi
done
# go ahead and print for your pleasure
# the log file is saved and you would have to delete it by hand
# to clear it
cat /home/castlebb/logcheck1 | more
#last line of script


> 2001
> |-Jan
> |-Feb
> 2002
> |-Jan
> |-Feb
> 2003
> |-Jan
> |-Feb
> 
> Aprox. 3 years or 3000 Word files.  [Yes Bobkat, I've tried to do it 
> on my own.]
> Thanks,
> Doug Wyman

hope this helps man, oh and i don't know if you got my email a while
back ago but i picked up evilkat.com

meow

Bob T. Kat

-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.