find command sort options?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers find command sort options?
# 1  
Old 03-31-2008
find command sort options?

Hi - are there sort options with the find command? I don't see any in man. I have a script that is looping through a set a files to be processed and I need to process them in date timestamp order. tia

for file in `find ${LANDING_FILE_DIR}${BTIME_FILENAME_PATTERN1}`
do....
...
# 2  
Old 03-31-2008
Why not use "ls" instead of "find"? Like

for FILE in $(ls -1tr ${LANDING_FILE_DIR}${BTIME_FILENAME_PATTERN1})
do
...
# 3  
Old 03-31-2008
The ls may be better then using find since I'm expecting the files to be in the same directory each time....Thanks..Smilie
# 4  
Old 03-31-2008
export LANDING_FILE_DIR="/xfer/appl/btime/"
export JTIME_FILENAME_PATTERN1="BTIME_ACTUAL_WORK_HRS_wk_[0-9][0-9]_to_[0-9][0-9].csv"


for file in $(ls -1tr ${LANDING_FILE_DIR}${JTIME_FILENAME_PATTERN1})

is giving error...
..../BTIME_ACTUAL_WORK_HRS_wk_[0-9][0-9]_to_[0-9][0-9].csv not found


Can [0-9] not be used with ls?

tia
# 5  
Old 03-31-2008
can you help me i want introduction about unix please help me.
# 6  
Old 03-31-2008
I have tried in the bash, and ls can use the pattern[0-9] as a filter.

Are you sure there are files matched the pattern in the specified directory?
# 7  
Old 04-01-2008
Tools

The files land in a specified directory at varying times of a day. Each file will be uniquely named but follow a pattern.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Multiple search options in find command

Hi, I'd like find multiple file options to fetch different types of files. find /path...// -type f -name "*.log" -o -name "*.req" -o -name "*.txt" -mtime +5 -exec ls -l {} \; Where as in the above command only the last .txt files its retriving but not .log and .req files can body help... (1 Reply)
Discussion started by: Y.balakrishna
1 Replies

2. UNIX for Dummies Questions & Answers

UNIX find command - using multiple -name options

Hi all, What am trying do is search for a directory that is owned by cm that only exists in a path that has a particular directory ex: what I'm using now is find . -user cm -name '*.rel' -type d -exec ls -dl {} \; This is giving me stuff like this ./../../foo1/../../*.rel... (2 Replies)
Discussion started by: jtmed
2 Replies

3. Shell Programming and Scripting

find: -prune and -name options

I am trying to find all .rhosts files on some unix systems. I tried just -name ".rhosts" but we have a lot of really large NFS and MVFS systems that I do not want to crawl and I am having a hard time excluding them. I also need to scan more than just /root /home and /users, so I really need to scan... (1 Reply)
Discussion started by: nitrobass24
1 Replies

4. Shell Programming and Scripting

find command with sort

HI Find command is sorting differently in different machines. I am trying a script to find file with -name option and delete the files other and keep the latest. the problem I am facing is in one machine find command is returning output sorted with oldest first and latest . But in another... (1 Reply)
Discussion started by: ningy
1 Replies

5. UNIX for Dummies Questions & Answers

sort file returned by FIND command in ascending

Hi there I have to enhance my current file looping to ensure the oldest file being processed first. current command: for FILENAME in `find $MY_DIRECTORY -follow -type f` I manage to get command for order by date modified descending, just can't get the ascending order. Please help for... (3 Replies)
Discussion started by: elsie512
3 Replies

6. Shell Programming and Scripting

find command to use multiple -exec options

Hello All, Is there a way to make exec do a couple of operations on a single input from find? For example, find . -type d -exec ls -l "{}" ";" I would like to give the result of each "ls -l" in the above to a wc. Is that possible? I want to ls -l | wc -l inside exec. How do I... (1 Reply)
Discussion started by: prasanna1157
1 Replies

7. Shell Programming and Scripting

Command to sort directories after a recursive find

find -type d -name "TC_*" | sort That's what I have so far... it finds the appropriate directories and then sorts them. But, when it comes to nested subdirectories, it only sorts relative to the first subdirectory. I want it to sort based on the directory at the end of the path. Does anyone know... (3 Replies)
Discussion started by: crimsondarkn
3 Replies

8. Shell Programming and Scripting

help me to sort kill options...

Hi All, I knew you all will scold me after reading this thread, but i got stuck in the definition and usage of kill, so begging all your pardon. I have a java process, which used to create small threads/sub process....so i want to kill that main java by kill -0 <pid>...... so that 1st it... (1 Reply)
Discussion started by: manas_ranjan
1 Replies

9. Shell Programming and Scripting

options in FIND utility

hi folks, I want to select all files older than 13 days from a specified directory for that i used find /home/amar -name '*.*' -mtime 13 but it gives me all the files from subdirectories also, I dont want that I want files only from /home/amar and not from /home/amar/abc/.. which... (8 Replies)
Discussion started by: amarnath
8 Replies

10. UNIX for Dummies Questions & Answers

Find command with prune and exec options

Hi, I'm using the following command to get a list of files on the system. find /releases -type f -exec ls -l > /home/sebarry/list.txt '{}' \; however, its searching a directory I don't want it to search so I know I have to use prune but I don't seem to be able to get prune and exec to work... (2 Replies)
Discussion started by: Sebarry
2 Replies
Login or Register to Ask a Question