using find cmd to find certain files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting using find cmd to find certain files
# 1  
Old 05-20-2008
using find cmd to find certain files

i have a list of files below:

rwxrwxrwx 1 pipe pipe 180 Mar 4 22:47 del_0n_Date
-rwxrwxrwx 1 pipe pipe 472 Mar 4 22:58 mail_Check
-rw-r--r-- 1 pipe pipe 92 Mar 4 22:58 minfo.txt
-rwxrwxrwx 1 pipe pipe 609 Mar 5 05:12 Start_end_time
-rw-r--r-- 1 pipe pipe 7540 Mar 5 05:12 Report.txt
-rw-r--r-- 1 pipe pipe 1830 Mar 11 04:44 logs_delay.txt
-rwxrwxrwx 1 pipe pipe 1041 Mar 11 05:11 logs_updates
-rwxrwxrwx 1 pipe pipe 596 Mar 11 07:02 days_diff
-rw-r--r-- 1 pipe pipe 1535 Mar 11 07:29 FILE_INFO
-rw-r--r-- 1 pipe pipe 15192 Mar 18 04:55 core
-----------------------------------------------------------------------

how to find this files that all belong to march using find command.I mean i want to use find command to list all the files that are modified in Mar. I have some 1000 files.
# 2  
Old 05-20-2008
Instead of find , u can use awk


ls -ltr | awk '$6=="Mar" { print $9}'


Thanks
Penchal
# 3  
Old 05-20-2008
yes that is true......but u know i first need to find those files and then copy it to a dir......if i use redirect the it would only copy the name and not the contents

ls -ltr | grep "Mar" >> files_info.txt

------------------------------------

so i want to use find command to list all the Mar files....
# 4  
Old 05-20-2008
This might help u

ls -ltr | awk '$6=="Mar" { print $9}' | xargs -i cp {} new_dir_Path/{}
# 5  
Old 05-20-2008
Thanks a lot for ur help dear.......

is there any way that we can use find to list files apart from grep....by conditions like modified date or size.....
# 6  
Old 05-20-2008
Code:
find /path/to/find -type f -mtime -50 | xargs -i cp '{}' path/to/copy


Last edited by namishtiwari; 05-20-2008 at 02:39 AM..
# 7  
Old 05-20-2008
Code:
find . -type f -mtime +50 -mtime -81 -ls

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Find cmd and sym links

Hi. Can somebody tell me if there's a way of creating a symbolic link from a directory on one filesystem to that on another that will allow a find command that doesn't use the -L param to locate a particular file under that new 'linked' dir. With a normal sym link the find command on that... (6 Replies)
Discussion started by: user052009
6 Replies

2. Shell Programming and Scripting

UNIX cmd -find empty files in folder else sleep for 8hrs

Hello, I am trying to write a unix cmd , that if files in folder /path/FTP are all zero kb or empty then good to go, if not empty then sleep for 8 hrs. Following cmd list me the files which are not empty, But when I am incorporating IF ELSE cmd fails find /path/FTP. -type f -exec wc -l {}... (6 Replies)
Discussion started by: bluestarmoon
6 Replies

3. Shell Programming and Scripting

Using a single "find" cmd to search for multiple file types and output individual files

Hi All, I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd. What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
Discussion started by: swaters
3 Replies

4. UNIX for Dummies Questions & Answers

Help with the find cmd

Hello, I'm having a trouble with the find cmd. I would like to find all the java versions on my systems. I have solaris 9 & 10 RHEL and SUSIE. java -version doesn't give all the versions on the server. So I am trying to use the find command to find them all find / -name java I would... (7 Replies)
Discussion started by: bitlord
7 Replies

5. Shell Programming and Scripting

Nested find cmd

Hi gurus, greetings. Objective: find in a path directories that are named Logs. In each found Logs dir search for files with .log extension and remove -atime +6. (Note for test/example, rm and -atime is not used). Issue: If I execute the script without redirecting output to a file, on... (8 Replies)
Discussion started by: rsheikh
8 Replies

6. Shell Programming and Scripting

find cmd works different on cron job ?

/usr/bin/find $SEARCH_DIR -daystart \( \( -name 'KI*' -a -name '*.csv' \) -o -name '*_xyz_*' \) -mtime $DAYS_AGO -printf %f -printf "\n" | sort -r > $FILES The above command gives different results when run on a cron job. When run manually the result is accurate. (2 Replies)
Discussion started by: nuthalapati
2 Replies

7. Shell Programming and Scripting

How to link lsof and find cmd?

Hi All, My target is to find the biggest files opened by any process and from that i have to find process id and the corresponding file also to avoid file system being hung-up. Finding the process id: is to kill the process Finding the biggest file: is to remove the file To get the process... (0 Replies)
Discussion started by: Arunprasad
0 Replies

8. Shell Programming and Scripting

date with find cmd

Hi for today i have 10 files, in that i need search some values how can i write a find cmd with perticular date thanks SAIC (4 Replies)
Discussion started by: saic
4 Replies

9. Shell Programming and Scripting

Find cmd not working correctly in script

I am trying to copy 2 types of files so I can archive them. I tested with a set of commands: touch -t $(date -d "-60 day" +%Y%m%d) WORKDIR/REF find TARGETDIR/ -type f -maxdepth 1 -iname \*.out\* -or -iname \*.log\* ! -newer WORKDIR/REF -exec ls -l {} \; This correctly lists any files in the... (2 Replies)
Discussion started by: prismtx
2 Replies

10. Shell Programming and Scripting

Find cmd not working as expected

Hi, i wan to search the file starting with Admin into the directory Output. I am running below command: find /appl/Output -name "Admin*" -prune but this command is going into the sub directories present under output. I do not want to search under sub directories. Any help will be highly... (6 Replies)
Discussion started by: Vishal123
6 Replies
Login or Register to Ask a Question