Computing.Net > Forums > Unix > Using .txt file to do search

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Using .txt file to do search

Reply to Message Icon

Name: ndavaul
Date: October 17, 2006 at 07:24:13 Pacific
OS: Unix
CPU/Ram: Pentium 4, 512MB
Product: Dell/D610
Comment:

I need help writing a search unix script. I have a .txt file with a long list of files. I would like to know is there a way to write a script that will search a entire directory and/or folders inside that directory for each line of the txt file?

For Example:
The list.txt file has the following:
smile.img
difp.img
mrew.crv
etc., etc., etc..

The script will search the designated directory, first for smile.img, and if it's found, output it to another txt file called found.txt. Then go to the next line, difp.img, search, then mrew.crv, search, etc....
So at the end of the search, I will have found.txt that contains "found" files. and if none are found. Say, "No duplicates Found"

I've researched online as much as possible, but no luck finding help.




Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: October 17, 2006 at 09:15:29 Pacific
Reply:

This looks like homework, but I'll give you part of it:

while read fname
do
find $fname -type f -print

done < list.txt


0
Reply to Message Icon

Related Posts

See More


Easiest Question EVER? sed - How to do condition...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Using .txt file to do search

Transfering text files to dos www.computing.net/answers/unix/transfering-text-files-to-dos/2269.html

Data Conversion - Unix WK1 files to DOS/Win www.computing.net/answers/unix/data-conversion-unix-wk1-files-to-doswin/403.html

Using while loop to read a file www.computing.net/answers/unix/using-while-loop-to-read-a-file/7092.html