Sponsored Content
Full Discussion: find command in for loop
Top Forums UNIX for Dummies Questions & Answers find command in for loop Post 302584199 by vmachava on Thursday 22nd of December 2011 11:10:45 AM
Old 12-22-2011
find command in for loop

i have executed the following command in terminal

Code:
find /Users/vasu -name "*.txt" -print

and i am getting the result 

/Users/vasu/file1.txt
/Users/vasu/file2.txt
/Users/vasu/file3.txt

but while i was trying to execute the same in the script it is not working,I tried with below logic in the shell script

Code:
for f in find /Users/vasu -name "*.txt"
do
    echo "$f"
done

output:find
/Users/vasu/Documents/pragathi_unix_practice/master_unix_practice/textfiles
-name
*.txt

can i achieve this by doing any modifiaction?please tell me the reason as well for modificationSmilie

Last edited by methyl; 12-22-2011 at 12:49 PM.. Reason: Added some code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command find returned bash: /usr/bin/find: Argument list too long

Hello, I create a file touch 1201093003 fichcomp and inside a repertory (which hava a lot of files) I want to list all files created before this file : find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long but i make a filter all... (1 Reply)
Discussion started by: yacsil
1 Replies

2. 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

3. Shell Programming and Scripting

How to combine "find" command in for each loop (tcsh)

Hello I was wandering if I can combine find command in side for each loop in unix the main propose is to change some thing in files from several types and not all of them is this possible ? (on liner script? ) tnx for the helppers (3 Replies)
Discussion started by: umen
3 Replies

4. Shell Programming and Scripting

Little bit weired : Find files in UNIX w/o using find or where command

Yes , I have to find a file in unix without using any find or where commands.Any pointers for the same would be very helpful as i am beginner in shell scritping and need a solution for the same. Thanks in advance. Regards Jatin Jain (10 Replies)
Discussion started by: jatin.jain
10 Replies

5. Shell Programming and Scripting

find command in while loop - how to get control when no files found?

I have the following statement in script: find ${LANDING_FILE_DIR}${BTIME_FILENAME_PATTERN2} -print | while read file; do ... done When there are no files located by the find comand it returns: "find: bad status-- /home/rnitcher/test/....." to the command line How do I get control in... (3 Replies)
Discussion started by: mavsman
3 Replies

6. 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

7. UNIX for Dummies Questions & Answers

how to find a file named vijay in a directory using find command

I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem. so i need to use find command (6 Replies)
Discussion started by: amirthraj_12
6 Replies

8. Shell Programming and Scripting

find in for loop

What's wrong with this script for i in Users.csv anc.csv > do > find . -name $i > doneDouble post. Continue here. (0 Replies)
Discussion started by: theshashi
0 Replies

9. 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

10. 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
X2SYS_MERGE(1gmt)					       Generic Mapping Tools						 X2SYS_MERGE(1gmt)

NAME
x2sys_merge - Merge an updated COEs tables SYNOPSIS
x2sys_merge -Amain_COElist.d -Mnew_COElist.d DESCRIPTION
x2sys_merge will read two crossovers data base and output the contents of the main one updated with the COEs in the second one. The second file should only contain updated COEs relatively to the first one. That is, it MUST NOT contain any new two tracks intersections (This point is NOT checked in the code). This program is useful when, for any good reason like file editing NAV correction or whatever, one had to recompute only the COEs between the edited files and the rest of the database. -A Specify the file main_COElist.d with the main crossover error data base. -M Specify the file new_COElist.d with the newly computed crossover error data base. OPTIONS
No space between the option flag and the associated arguments. EXAMPLES To update the main COE_data.txt with the new COEs estimations saved in the smaller COE_fresh.txt, try x2sys_merge -ACOE_data.txt -MCOE_fresh.txt > COE_updated.txt SEE ALSO
x2sys_binlist(1), x2sys_cross(1), x2sys_datalist(1), x2sys_get(1), x2sys_init(1), x2sys_list(1), x2sys_put(1), x2sys_report(1) GMT 4.5.7 15 Jul 2011 X2SYS_MERGE(1gmt)
All times are GMT -4. The time now is 09:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy