Sponsored Content
Full Discussion: find a file
Top Forums Shell Programming and Scripting find a file Post 302270876 by reddyrajal on Tuesday 23rd of December 2008 05:49:50 AM
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
 

9 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

9. 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
calendar(1)						      General Commands Manual						       calendar(1)

Name
       calendar - calendar reminder service

Syntax
       calendar [-]

Description
       The  command  consults the file `calendar' in the current directory and prints out lines that contain today's or tomorrow's date.  The com-
       mand recognizes most month-day dates, such as Dec. 7, december 7, 12/7, but it does not recognize dates formatted in the following ways:  7
       December  or  7/12.  If you give the month as * with a date, such as, * 1, that day in any month will do.  On weekends, specifying tomorrow
       extends through Monday.

       When an argument is present, the command searches through a user's calendar file in his login directory and sends him any positive  results
       by Normally this is done daily under control of

       The  calendar  file  is	first  run  through  the  C  preprocessor, to include any other calendar files specified with the #include syntax.
       Included calendars are shared by all users, and are maintained and documented by the local administration.

Options
       -    Functions for every user who has a calendar file in his login directory.

Restrictions
       The extended idea of tomorrow does not account for holidays.

Files
       calendar
       /usr/lib/calendar to figure out today's and tomorrow's dates
       /etc/passwd
       /tmp/cal*
       /lib/cpp, egrep, sed, mail as subprocesses

See Also
       at(1), cron(8), mail(1)

																       calendar(1)
All times are GMT -4. The time now is 10:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy