Bulk find in UNIX at unknown dir location


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bulk find in UNIX at unknown dir location
# 1  
Old 05-27-2013
RedHat Bulk find in UNIX at unknown dir location

Dear All,
I have a file which is having a number my_file.csv

Code:
032001031
100509001
203001165

there are many more about 5000.

I have a path in unix
Code:
/my_path/my_loc/DEV/RPD10/CPD25/WFM/RK_WFM/OUT/*/

where i will have a file like
Code:
CPD25_203001165.pdf
CPD25_100509001.pdf
CPD25_203001165.pdf

I want to match and find out whether all my 5000 files are present in unix dir .
Code:
/my_path/my_loc/DEV/RPD10/CPD25/WFM/RK_WFM/OUT/*/

please suggest.
# 2  
Old 05-27-2013
Code:
cd /my_path/my_loc/DEV/RPD10/CPD25/WFM/RK_WFM/OUT/
ls -1 *.pdf > PDFFiles
awk -F"[._]" 'NR==FNR{a[$2]++;next}
{ printf a[$1]?$0" File Presnt\n":$0" File not present\n"}' PDFFiles my_file.csv

# 3  
Old 05-27-2013
one simple solution would be to run a loop and then match the resulting files from within the directory. could be something like

Code:
for numeric in ` cat my_file.csv`
do
echo "Going for $numeric"
ls -l /my_path/my_loc/DEV/RPD10/CPD25/WFM/RK_WFM/OUT/*/CPD25_"$numeric".pdf
if [[ $? -eq "0" ]]; then 
echo "$numeric Found"
else  
echo "$numeric Not Found"
fi
done


Remember you'll have to fulfill the "*" and "CPD25_" variables accordingly, where they need to differ from this code.

Rgs
# 4  
Old 05-27-2013
Quote:
Originally Posted by pravin27
Code:
cd /my_path/my_loc/DEV/RPD10/CPD25/WFM/RK_WFM/OUT/
ls -1 *.pdf > PDFFiles
awk -F"[._]" 'NR==FNR{a[$2]++;next}
{ printf a[$1]?$0" File Presnt\n":$0" File not present\n"}' PDFFiles my_file.csv

no luck..

---------- Post updated at 06:06 AM ---------- Previous update was at 06:06 AM ----------

Quote:
Originally Posted by busyboy
one simple solution would be to run a loop and then match the resulting files from within the directory. could be something like

Code:
for numeric in ` cat my_file.csv`
do
echo "Going for $numeric"
ls -l /my_path/my_loc/DEV/RPD10/CPD25/WFM/RK_WFM/OUT/*/CPD25_"$numeric".pdf
if [[ $? -eq "0" ]]; then 
echo "$numeric Found"
else  
echo "$numeric Not Found"
fi
done


Remember you'll have to fulfill the "*" and "CPD25_" variables accordingly, where they need to differ from this code.

Rgs
no luck on this
# 5  
Old 05-27-2013
Hi yadavricky,

Please let us know issue which you have faced.

~pravin~
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find a existing file location and directory location in Solaris box?

Hi This is my third past and very impressed with previous post replies Hoping the same for below query How to find a existing file location and directory location in solaris box (1 Reply)
Discussion started by: buzzme
1 Replies

2. Shell Programming and Scripting

Bulk Find and Replace

Hi Friends, I have a directory with a ton of .html files, like this ls -m1 dir 1.html 2.html 3.html 4.html Somewhere in the files, there is a pattern like this 1.html http://unix.com/cgi-bin/task?taskid=12010&task.out 2.html http://unix.com/cgi-bin/task?taskid=11110&task.out... (1 Reply)
Discussion started by: jacobs.smith
1 Replies

3. Shell Programming and Scripting

KSH - Find paths of multiple files in CC (dir and sub-dir))

Dear Members, I have a list of xml files like abc.xml.table prq.xml.table ... .. . in a txt file. Now I have to search the file(s) in all directories and sub-directories and print the full path of file in a output txt file. Please help me with the script or command to do so. ... (11 Replies)
Discussion started by: Yoodit
11 Replies

4. Shell Programming and Scripting

what is the find command to find exact dir from the root

I want to find a dir called STOP from the root.so what is the find command. Thanks & Regards Rajkumar (1 Reply)
Discussion started by: rajkumar_g
1 Replies

5. Shell Programming and Scripting

A script to find dir, delete files in, and then del dir?

Hello!! I have directories from 2008, with files in them. I want to create a script that will find the directoried from 2008 (example directory: drwxr-xr-x 2 isplan users 1024 Nov 21 2008 FILES_112108), delete the files within those directories and then delete the directories... (3 Replies)
Discussion started by: bigben1220
3 Replies

6. Shell Programming and Scripting

Shell scripting for Bulk transports in unix

Hi friends, I would like to trasnport a bulk request in hp-ux for SAP ECC6.0 system, would request you to please send shell script for this. tp addtobuffer <request nos.> sid i want a shell script to run at unix level. Regards XXXXXXXXX (4 Replies)
Discussion started by: mahantysk
4 Replies

7. UNIX for Dummies Questions & Answers

How to find files whose case is unknown

Hello experts, can you kindly tell me how I can look for a file in unix whose name may contain upper or lowercase letters? E.g. If I know the file contains the name netcool but unsure if its NETCOOL or netcool? Thanks :) (3 Replies)
Discussion started by: mitkapadia
3 Replies

8. Programming

To find a existence of a dir within a dir

Hi, I want to find whether a dir "temp" is present inside a dir. It should get a dir a input and search recursively within that directory to check whether temp is present and return 1 or return 0 if it is not present anywhere inside the directory/sub-directory. I know we can use readdir in the... (1 Reply)
Discussion started by: spsenthil
1 Replies
Login or Register to Ask a Question