find a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find a file
# 1  
Old 12-23-2008
find a file

hi all,

Suppose this December month of 2008, my requirement is like if i entered any day of December month, it will show the files that are modified in November month of 2008, if i entered any day of November month, it will show the files that are modified in October month and so on .



reply me
# 2  
Old 12-23-2008
try this

echo -n "enter date: ";read DATE && ll --time-style="+%F %T" | awk 'NR>1{ for(i=6;i<NF;i++){printf "%s ",$i} print $NF }' | grep ^"$DATE"


you need to give date in 2008-12-22

sample test you can give time also or you can give simply 2008 it will give all files with edited in 2008

enter date: 2008-12-22 16
2008-12-22 16:15:00 file2_tmp
2008-12-22 16:14:51 file_tmp

enter date: 2008-12-22
2008-12-22 12:07:14 2
2008-12-22 14:31:36 dec-13.txt
2008-12-22 20:29:54 file
2008-12-22 19:43:32 file1
2008-12-22 15:42:08 file2
2008-12-22 16:15:00 file2_tmp
2008-12-22 16:14:51 file_tmp
2008-12-22 14:58:03 file.txt
2008-12-22 17:03:30 list
2008-12-22 14:04:58 list.txt
2008-12-22 15:39:40 test2
2008-12-22 12:59:58 testing
2008-12-22 14:35:49 test.txt
2008-12-22 14:19:09 TODAY.txt
2008-12-22 14:01:10 unsub.txt

enter date: 2008
2008-12-22 12:07:14 2
2008-12-22 14:31:36 dec-13.txt
2008-12-17 19:20:27 Desktop
2008-12-17 18:19:37 Documents
2008-12-23 14:05:02 Download
2008-12-23 13:21:36 error
2008-12-22 20:29:54 file
2008-12-22 19:43:32 file1
2008-12-22 15:42:08 file2
2008-12-22 16:15:00 file2_tmp
2008-12-22 16:14:51 file_tmp
2008-12-22 14:58:03 file.txt
2008-12-15 18:57:10 Install
2008-12-22 17:03:30 list
2008-12-22 14:04:58 list.txt
2008-12-23 15:14:54 Music
2008-12-05 15:44:08 Photos
2008-12-17 14:45:54 Pictures
2008-12-05 13:35:06 Public
2008-12-19 21:13:58 sample
2008-12-18 13:47:17 scripts
2008-12-23 12:48:16 sort1.tmp
2008-12-15 12:53:56 temp.txt
2008-12-22 15:39:40 test2
2008-12-22 12:59:58 testing
2008-12-19 12:28:21 test.sh
2008-12-22 14:35:49 test.txt
2008-12-15 17:05:13 Videos
2008-12-07 11:28:34 workspace
# 3  
Old 12-23-2008
i would rather suggest use the find utility with mtime option
find . -mtime <time> -type f
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can you use find with ps or doing find excluding file in use

Hi, I am currently using the find below to remove old files. I am redirecting the listing to a file and then use a while-loop and do a rm cd ${directory} find . \( ! -name . -prune \) \( -type f -name "*.trc" -mtime +10 \) | sed 's#^./##' | sed "s#^#${directory}/#" 2>/dev/null | tee -a... (4 Replies)
Discussion started by: newbie_01
4 Replies

2. Shell Programming and Scripting

How to find a file with a specific pattern for current sysdate & upon find email the details?

I need assistance with following requirement, I am new to Unix. I want to do the following task but stuck with file creation date(sysdate) Following is the requirement I need to create a script that will read the abc/xyz/klm folder and look for *.err files for that day’s date and then send an... (4 Replies)
Discussion started by: PreetArul
4 Replies

3. Shell Programming and Scripting

wanted to find both link file and ordinary file using single find command

find . -type fl o/p is only the ordinary file. where in it wont give the link files. (2 Replies)
Discussion started by: nikhil jain
2 Replies

4. Shell Programming and Scripting

Find multiple string in one file using find command

Hi, I want find multiple string in one file using find coomand. And keeping it in one variable.grep is not working. (5 Replies)
Discussion started by: vivek1489
5 Replies

5. Shell Programming and Scripting

How to use grep & find command to find references to a particular file

Hi all , I'm new to unix I have a checked project , there exists a file called xxx.config . now my task is to find all the files in the checked out project which references to this xxx.config file. how do i use grep or find command . (2 Replies)
Discussion started by: Gangam
2 Replies

6. Linux

Simplified find command to find multiple file types

Hi, I'm using the following command to find the multiple requierd file types and its working fine find . -name "*.pl" -o -name "*.pm" -o -name "*.sql" -o -name "*.so" -o -name "*.sh" -o -name "*.java" -o -name "*.class" -o -name "*.jar" -o -name "*.gz" -o -name "*.Z" -type f Though... (2 Replies)
Discussion started by: vickramshetty
2 Replies

7. UNIX for Dummies Questions & Answers

How to find a file whick is consuming larger disk space in file system

Hello, Can anybody please tell me the command to find out the filesystem or a file which is consuming larger disk space sing i want to find out the file and want to compress it please help me out any help would be appreciated (6 Replies)
Discussion started by: lokeshpashine
6 Replies

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

9. Shell Programming and Scripting

how to find a file in UNIX without find command?

given a start directory,a filename,how to find it? (3 Replies)
Discussion started by: bluo
3 Replies
Login or Register to Ask a Question