reading files for specific dates


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting reading files for specific dates
# 1  
Old 06-07-2004
reading files for specific dates

assume files are in a directory

/data

$ ls -ltr
Just displaying Data and file name:
01/01/2004 file_3434_typea.dat
01/01/2004 file_3423_typea.dat
01/01/2004 file_3436_typea.dat
01/01/2004 file_3434_typeb.dat
01/01/2004 file_3423_typeb.dat
01/01/2004 file_3436_typeb.dat
01/02/2004 file_3423_typea.dat
01/02/2004 file_3434_typea.dat
01/02/2004 file_3423_typea.dat

inside the file it just has the counts (a log file)

how do i look for files for a particuler date (01/01/2004) and files of type (file-*typea) etc.

thanks for any help
# 2  
Old 06-07-2004
i am new to unix, will this command be okay.

find /data . -name 'filename*' -mtime -1
# 3  
Old 06-07-2004
man find Smilie
# 4  
Old 06-08-2004
Code:
find /data . -name 'filename*' -mtime -1

Change the minus one to a value that goes back 188(?) days to January 2.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Moving files with specific dates

Hi, These are the list of files in one directory in the server : # ls -lrt total 10120 -rw-r--r-- 1 root root 4484 Jul 8 2011 install.log.syslog -rw-r--r-- 1 root root 51890 Jul 8 2011 install.log -rw------- 1 root root 3140 Jul 8 2011 anaconda-ks.cfg drwxr-xr-x 2 root root... (2 Replies)
Discussion started by: anaigini45
2 Replies

2. Shell Programming and Scripting

How to compare two dates in a specific format ?

Hello, I am not able to find how to compare two dates in '%Y-%m-%d %H:%M:%S,%3N' format i have to two dates as below date1="2016-08-24 09:47:40,444" date2="2016-08-24 10:45:40,567" how to compare these two dates ? I have tried below without success if ; then echo 'yes'; fi ... (6 Replies)
Discussion started by: Ramneekgupta91
6 Replies

3. UNIX for Dummies Questions & Answers

Reading the dates from a file & moving the files from a directory

Hi All, I am coding for a requirement where I need to read a file & get the values of SUB_DATE. Once the dates are found, i need to move the files based on these dates from one directory to another. ie, this is how it will be in the file, SUB_DATE = 20120608,20120607,20120606,20120606... (5 Replies)
Discussion started by: dsfreddie
5 Replies

4. UNIX for Dummies Questions & Answers

[bash] Reading two files and change a specific field

Hi all. I have 2 files like these: file1 3 -2 5 4 . . . 3 3 3 4 . . . 2 2 3 4 . . . 3 -2 8 4 . . . file2 0.4242 2 3 4 . . . 2.562 7 3 4 . . . 0.7242 5 5 4 . ... (3 Replies)
Discussion started by: t_studen_t
3 Replies

5. Shell Programming and Scripting

Question on reading dates in folders/files

Hi All, I have some folder that are named "FOLDERYYYYMM". I'm trying to piece together a .sh script that will look for the folder with the date. How can I get shell to see the date? (3 Replies)
Discussion started by: bbbngowc
3 Replies

6. Shell Programming and Scripting

Reading text file and comparing the dates in Kshell

I have a text file in which holidays are listed as YYYYMMDD. Here is the sample data of the file. 20090911 20090912 20090913 I need to read this file and see if the current day is listed in this text file. If today and any of the rows in my text file match, I need to do further... (2 Replies)
Discussion started by: Pramodini Rode
2 Replies

7. Shell Programming and Scripting

Parsing log files, displaying logs between specific dates

Sorry, couldn't really think of a simple subject/title. So, I have a log file, and the dates are displayed like so: 2009-03-05 02:49:44 So the first and second field are the date/time. I can change them into a unix timestamp easily with: date -d "2009-03-05 02:49:44" +%s However,... (17 Replies)
Discussion started by: Rhije
17 Replies

8. UNIX for Dummies Questions & Answers

To find files with specific dates and cp another folder.

Hi all, We have an existing script: find /u03/oraprod/perpcomn/admin/out -type f -ctime +7 \ -exec cp {} "/u08/oraprod/backup/cout" \; Which is to find all files more than 7 days and copy to another folder. However I would like to only list files with Sep 29, and cp to another folder. ... (2 Replies)
Discussion started by: *Jess*
2 Replies

9. Shell Programming and Scripting

Reading specific contents from 1 input files and appending it to another input file

Hi guys, I am new to AWK and unix scripting. Please see below my problem and let me know if anyone you can help. I have 2 input files (example given below) Input file 2 is a standard file (it will not change) and we have to get the name (second column after comma) from it and append it... (5 Replies)
Discussion started by: sksahu
5 Replies

10. Shell Programming and Scripting

How to calculate specific hours between 2 dates

Hi there, I am trying to find out a way to calculate how many hours are between 2 dates but from a specific time range, actually working hours (Monday to Friday 09:00 - 18:00). What I mean is for example date1 = Monday 21 July 2008 22:00:00 so in python 2008-07-21 22:00:00 date2 = Wednesday... (5 Replies)
Discussion started by: sickboy
5 Replies
Login or Register to Ask a Question