find in for loop


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find in for loop
# 1  
Old 03-14-2011
find in for loop

What's wrong with this script

Code:
for i in Users.csv anc.csv
> do
>  find . -name $i
> done

Moderator's Comments:
Mod Comment Double post. Continue here.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

While loop, input from find command

Hello nix Experts, I am a *nix rookie and have run into this issue, can some one help me here and let me know what I am doing wrong. /home/user1> while read n > do > echo $n > done < <(find . -type f -ctime -1 | grep abc) I am getting the below error: -sh: syntax error near... (5 Replies)
Discussion started by: babyPen1985
5 Replies

2. UNIX for Dummies Questions & Answers

find command in for loop

i have executed the following command in terminal find /Users/vasu -name "*.txt" -print and i am getting the result /Users/vasu/file1.txt /Users/vasu/file2.txt /Users/vasu/file3.txtbut while i was trying to execute the same in the script it is not working,I tried with below logic in... (2 Replies)
Discussion started by: vmachava
2 Replies

3. Shell Programming and Scripting

Loop with Find—damn spaces!

Hi Guys, I'm trying to find all files with a particular extension and then loop some actions. The problem is that if the files have spaces in their names I get end up being each word as a separate result rather than the entire file. ext=".txt" out=".rtf" for i in $( find "$1" -name "*$ext" );... (9 Replies)
Discussion started by: imonkey
9 Replies

4. Shell Programming and Scripting

find in for loop

whats wrong with this script for i in Users.csv abd.csv > do > find . -name $i > done (2 Replies)
Discussion started by: theshashi
2 Replies

5. Shell Programming and Scripting

Find result using for loop

I want to print each file i found using the find command. And not able to list the files at all here is the code SEARCH_DIR="/filesinfolder"; PATH_COUNT=0 for result in "'/usr/bin/find $SEARCH_DIR -daystart \( \( -name 'KI*' -a -name '*.csv' \) -o -name '*_xyz_*' \) -mtime 1'" do... (1 Reply)
Discussion started by: nuthalapati
1 Replies

6. Shell Programming and Scripting

find a string in a loop

Hi, Can anyone help with the problem below? I need to read all text files (file1, file2, file3) in a loop and find file1.txt: file2.txt: File3.txt: (7 Replies)
Discussion started by: Lenora2009
7 Replies

7. Shell Programming and Scripting

Help in loop find question at STEP 3

STEP 1 # Set variable FILE=/tmp/mainfile SEARCHFILE =/tmp/searchfile cat /tmp/mainfile Interface Ethernet0/0 "outside", is up, line protocol is up Hardware is i82546GB rev03, BW 100 Mbps Full-Duplex(Full-duplex), 100 Mbps(100 Mbps) MAC address 001e.f75e.8cb4, MTU 1500 IP address... (1 Reply)
Discussion started by: irongeekio
1 Replies

8. Shell Programming and Scripting

Loop and find not working ASAP

I grep some thing from file then in a loop give to find one by one but not working. #!/bin/bash grep -H DocumentRoot /etc/httpd/conf.d/*.conf | awk -F' ' '{ print $3 }'| sort -u | uniq > path.txt for j in `cat path.txt` do # echo "line is $i" find "$j" -type d... (3 Replies)
Discussion started by: aliahsan81
3 Replies

9. AIX

using find in for loop

hello gurus, src="/home/training" typ="*.sh" for i in `find $src -name $typ` do ... .. done the above code piece is giving this error: find: 0652-009 There is a missing conjunction I tried this way: for i in `find $src -name "$typ"` But then it didn't get any files, though there... (11 Replies)
Discussion started by: muthursyamburi
11 Replies

10. Shell Programming and Scripting

For Loop with find

I'm trying to write a script to archive some log files, and I'm getting a little stuck. My 'find' command by itself works great, returning all of the log files I need, but when I try to combine it with my loop, I'm getting an error. Here's what I have so far: for FILENAME in $(find . -type f... (4 Replies)
Discussion started by: kadishmj
4 Replies
Login or Register to Ask a Question