To find latest set of logs among new and old

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To find latest set of logs among new and old
# 1  
Old 06-09-2011
To find latest set of logs among new and old

Hi All

I am writing a script which will select the latest logs (which are generated every night via a script) among old one and new. Script generates set of 3 logs each time it runs. Example :


I have successfully written script to select latest logs(all 3 bkt) using "tail -1" cmd. Now, I am not getting idea to select latest log if only one log is generated (due to script failure) Like :


As my script is using "tail -1" it will include latest of each bkt and will give wrong result. I just want to parse the latest log and display error message.

Can someone help here ? Appreciate your help.

# 2  
Old 06-09-2011
Show us your script so we can help you further.

As for example this will find all files edited in the previous 24h.

find . -mtime -1 -type f

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Grep a pattern & Email from latest logs

MyLOG: 2017/11/12 17:01:54.600 : Error: LPID: 3104680848 WRONG CRITERIA FOUND. tRealBuilder::Generate Output Required: If Ke word "WRONG CRITERIA FOUND" in latest log ( logs are regularly generating - real time) mail to us once mailed wait for 2 hours for second mail. mail subject... (3 Replies)
Discussion started by: vivekn
3 Replies

2. Shell Programming and Scripting

Find latest date in folder

HI I have folder in home dir. /home/kpp/07222013 /home/kpp/07212013 /home/kpp/07202013 Output :-- /home/kpp/07222013 Just find latest date (5 Replies)
Discussion started by: pareshkp
5 Replies

3. Solaris

How to find the Latest Firmware

Dear All I have a Sun Fire v440 server. How to find the latest firmware for this server and from where i can download the firmware. What is theprocedure install the latest firmware. please share the process if possible. How can i check the latest firmware of any sun server. Tahnk u... (1 Reply)
Discussion started by: sudhansu
1 Replies

4. Shell Programming and Scripting

script to grep latest outofmemory string from the logs

I have requirement to prepare script which will grep for latest outofmemory message from the logs. I have used following command to grep the string from the logs,this script is not effective when logs are not getting updated as it will grep for old message. f=catalina.out var=`tail -10 $f |... (17 Replies)
Discussion started by: coolguyamy
17 Replies

5. Shell Programming and Scripting

set a variable with latest file name

Hi how to set a variable with the latest file name in a given folder in bash script. Thanks, MM (1 Reply)
Discussion started by: murtymvvs
1 Replies

6. Shell Programming and Scripting

Find the latest folder

Hi, I want to find out the files that are created the recent, how can I do it? find . -type d ( i dont know what option to use to find the latest, it can be 1 day old or 10 days, but want to pick the latest one only) Thanks, (5 Replies)
Discussion started by: rudoraj
5 Replies

7. Shell Programming and Scripting

Searching set of string from Live Running Logs

Hey just need one simple syntax to search for the string from the Live Running Logs. The strings are placed in a $infile & everytime the script should pull each string from $infile and should provide as an input for grepping from Live running logs on a rotational basis. So here are the Contents... (14 Replies)
Discussion started by: raghunsi
14 Replies

8. Shell Programming and Scripting

Pick the latest set of files

I have task in which I need to pickup a set of files from a directory depending on the following criteria: Every month 6 files are expected to arrive at /test. The files come with date timestamp and the latest file set for the month needs to be used Suppose this is the set of files that present... (5 Replies)
Discussion started by: w020637
5 Replies

9. Shell Programming and Scripting

how to use find command to get latest file

Is there a way to use find command to get the latest file and cp it into a certain dir at the same try. example find the latest file and cp to a diff dir. (5 Replies)
Discussion started by: shehzad_m
5 Replies

10. Shell Programming and Scripting

Find and remove all but the latest file

Hi, Would appreciate if someone could help me with the following requirement. Say I have a directory where a file called abc_$timestamp.txt is created couple of times in a day. So this directory would have files like abc_2007-03-28-4-5-7.txt abc_2007-03-28-3-5-7.txt... (4 Replies)
Discussion started by: hyennah
4 Replies
Login or Register to Ask a Question