Extracting log files based on date and time.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extracting log files based on date and time.
# 1  
Old 03-05-2013
Extracting log files based on date and time.

Hi All,

i have some log files generated in a folder daily with the format

abc.def.20130306.100001
ghi.jkl.20130306.100203
abc.def.20130305.100001
ghi.jkl.20130305.100203

the format is the date followed by time . all i want is to get the files that are generated for todays date alone.. please help...
# 2  
Old 03-05-2013
Code:
awk '/20130306/' logfile

# 3  
Old 03-05-2013
try also:
Code:
ls -1 | awk -F"." '$3==dt' dt=`date +"%Y%m%d"`

# 4  
Old 03-05-2013
Code:
ls -1 *$(date +%Y%m%d)*

OR
Code:
printf "%s\n" *$(date +%Y%m%d)*

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

2. UNIX for Dummies Questions & Answers

Condition based on Timestamp (Date/Time based) from logfile (Epoch seconds)

Below is the sample logfile: Userids Date Time acb Checkout time: 2013-11-20 17:00 axy Checkout time: 2013-11-22 12:00 der Checkout time: 2013-11-17 17:00 xyz Checkout time: 2013-11-19 16:00 ddd Checkout time: 2013-11-21 16:00 aaa Checkout... (9 Replies)
Discussion started by: asjaiswal
9 Replies

3. Shell Programming and Scripting

List Files Based On Time & Date

Hi All, I am using HP Unix. I want to list files which are created 5 minutes before on the same day as well as before today's date. I checked all the forums and the commands provided there does not work on HP Unix. Can you please help me on this? Your help is highly aprreciated. Thanks and... (3 Replies)
Discussion started by: angshuman
3 Replies

4. Shell Programming and Scripting

How to catch date and time from log files?

Hi, Appli.log files contain the below data which updates continuously ================================================== =============== Tuple Created OrderEntry|66|39.0|ADML.L|16.89|GBP||GFD|000002889 41ORLO1|GB00B02J6398|80|XLON|UHORIZON|null|2011-05-09... (11 Replies)
Discussion started by: pspriyanka
11 Replies

5. Shell Programming and Scripting

Identify log files based on time stamp,zip and then copy..HELP

Hi All, PFB is a requirement. I am new to shell scripting. So plz help. It would be highly appreciated. 1. choose all the log files based on a particular date (files location is '/test/domain')--i.e,we should choose all the files that are modified on 29th November, neither 28th nor 30th 2.... (3 Replies)
Discussion started by: skdas_niladri
3 Replies

6. Shell Programming and Scripting

Extracting date & time from file name

Hi, I am having a file name as exp_bkp_tables_18_Oct_2010_10_50_28.dmp which is used for import the records. Now, I want to print the output using the selected file name as below : Table records will get restored as on date 18-Oct-2010 and time 10:50:28 How it can be done ? With... (5 Replies)
Discussion started by: milink
5 Replies

7. Shell Programming and Scripting

Getting date output based on time zone

Hi, We have a server in US and hence while the command "date" is given it gives the output in EDT. If I want the date output in MET, how can I get it. Please let me know how I could do it in the script which is ksh. Thanks. (1 Reply)
Discussion started by: jmathew99
1 Replies

8. Shell Programming and Scripting

Extracting lines in file based on time

Hi, anyone has any ideas on how do we extract lines from a file with format similiar to this: (based on current time) Jun 18 00:16:50 .......... ............. ............ Jun 18 00:17:59 .......... ............. ............ Jun 18 01:17:20 .......... ............. ............ Jun 18... (5 Replies)
Discussion started by: faelric
5 Replies

9. Shell Programming and Scripting

Processing a log file based on date/time input and the date/time on the log file

Hi, I'm trying to accomplish the following and would like some suggestions or possible bash script examples that may work I have a directory that has a list of log files that's periodically dumped from a script that is crontab that are rotated 4 generations. There will be a time stamp that is... (4 Replies)
Discussion started by: primp
4 Replies

10. Shell Programming and Scripting

Extracting date-time from file.

I have the following file and need to extract date and time part for each record. Pl. could anyone provide an shell script which could be used to do it. Here is the file: /rgrdev/pdsud2/unx/agc/src/agcmst: /rgrsrc/pdspms/unx/agc/src/s.agcmst.for agcmst.for 420.20 8/4/07 18:30:53 ... (7 Replies)
Discussion started by: skumar11
7 Replies
Login or Register to Ask a Question