The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to list the files using File Descriptors shyjuezy UNIX for Dummies Questions & Answers 2 05-15-2008 02:05 AM
How to create a list of entries without vi mpc8250 Shell Programming and Scripting 3 02-13-2008 03:56 AM
Searching for all entries over 45 days chris654 Shell Programming and Scripting 2 01-11-2008 02:25 PM
Comparing 2 list and deleting deuplicate entries eltinator Shell Programming and Scripting 10 08-15-2007 01:35 PM
searching for list of empty directories man80 Shell Programming and Scripting 4 10-15-2004 04:00 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-18-2006
not4google not4google is offline
Registered User
  
 

Join Date: Oct 2006
Posts: 15
Searching list of entries in file for actual files in dir

Hi all,

I have a file entries.txt that contains a number of entries all on seperate lines e.g.

test1
test2
test3
test4

Then in a directory called /TestFiles I have a number of files that could contain the above text in the file name

e.g. qwertytest1.csv qwertytest2.csv qwertytest3.csv

How can I search the entries.txt to see if if the entries exist in the TestFiles directory?

Thanks,
  #2 (permalink)  
Old 10-18-2006
Glenn Arndt's Avatar
Glenn Arndt Glenn Arndt is offline Forum Advisor  
Anomalous Lurker
  
 

Join Date: Feb 2006
Location: Indianapolis, IN
Posts: 255
Code:
while read entry; do
  for f in /TestFiles/*$entry*; do
    print "Found $f"
  done
done < entries.txt
  #3 (permalink)  
Old 10-18-2006
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Code:
ls /TestFiles/* | grep -f entries.txt
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0