How to print the particular date logs on UNIX (Solaris)?


 
Thread Tools Search this Thread
Operating Systems Solaris How to print the particular date logs on UNIX (Solaris)?
# 1  
Old 09-03-2014
Oracle How to print the particular date logs on UNIX (Solaris)?

I would like to get only some particular date logs from /var/adm/messages. Please suggest any command or script to get this.
# 2  
Old 09-03-2014
try
Code:
ls -ltr | awk '{ if($6 == "Jul" && $7 == "10" && $8 == "2009") {print $0}}

It will print files for 10-07-2009

OR
Code:
ls -ltr | grep "Jul.*10.*2009"

# 3  
Old 09-03-2014
Oracle grep -i "Aug 29"

Simply we can use the below one, it works well.
Code:
#cat /var/adm/messages | grep -i "Aug 29"

It will list only Aug 29th logs. SmilieSmilie

Last edited by Franklin52; 09-03-2014 at 09:50 AM.. Reason: Please use code tags
# 4  
Old 09-03-2014
Quote:
Originally Posted by Makarand Dodmis
try
Code:
ls -ltr | awk '{ if($6 == "Jul" && $7 == "10" && $8 == "2009") {print $0}}

It will print files for 10-07-2009

OR
Code:
ls -ltr | grep "Jul.*10.*2009"


Makarand Dodmis
, please reread the question.

Quote:
Originally Posted by seenuvasan1985
Simply we can use the below one, it works well.
Code:
#cat /var/adm/messages | grep -i "Aug 29"

It will list only Aug 29th logs. SmilieSmilie
seenuvasan, Useless Use of Cat, this is sufficient:
Code:
grep -i "Aug 29" /var/adm/messages

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies

2. UNIX for Dummies Questions & Answers

Print start date to end date, given $1 & $2 in ksh

Dear all, I have an user passing 2 parameter 31/03/2015 and 02/04/2015 to a ksh script. How to print the start date to end date. Expected output is : 31/03/2015 01/04/2015 02/04/2015 Note : 1. Im using aix and ksh 2. I have tried to convert the given input into a date, didnt... (0 Replies)
Discussion started by: mr.rajaravi
0 Replies

3. Solaris

In Solaris 10 where to see print logs?

Hi friends, In Solaris 10 where to see print logs? Following is the command I used to give test page. echo "Michael Ponting - test page_New1" |lpr -P pip-qc3-lki890 pip-qc3-lki890 is print queue name. Please Advise. Thanks, Manali (3 Replies)
Discussion started by: manalisharmabe
3 Replies

4. Shell Programming and Scripting

How to print logs in unix prompt or to a log file?

I am executing a stored procedure through shell script. In the procedure, i have dbms_output.put_line to log the comments. This is working fine and but logs are available only after the execution of the pl/sql procedure's completion. I want to print the log comments while executing the procedure... (2 Replies)
Discussion started by: vel4ever
2 Replies

5. UNIX for Dummies Questions & Answers

Removing the logs of previous date

Hi folks, Please advise there is directory named logs and which there are several logs are there with the name appended by date , I can take out the latest one through cd /var/log ls -ltr but please suggest the command through which I can remove the logs of all the previous dats , the... (2 Replies)
Discussion started by: SankalpS
2 Replies

6. Shell Programming and Scripting

Compare last 90 logs and print repeating lines with >20

*log files are in date order sample logs... ciscoresets_20120314 ciscoresets_20120313 ciscoresets_20120312 ciscoresets_20120311 ciscoresets_20120310 cat ciscoresets_20120314 SYDGRE04,10,9 SYDGRE04,10,10 SYDGRE04,10,11 SYDGRE04,10,12 SYDGRE04,10,13 SYDGRE04,10,14 SYDGRE04,10,15... (2 Replies)
Discussion started by: slashbash
2 Replies

7. UNIX for Dummies Questions & Answers

print previous month (current month minus 1) with Solaris date and ksh

Hi folks month=`date +%m`gives current month Howto print previous month (current month minus 1) with Solaris date and ksh (7 Replies)
Discussion started by: slashdotweenie
7 Replies

8. Shell Programming and Scripting

not able to redirect the logs of a singl date in one system

Hi All, I have around 15 servers. I need to check for the error in /var/adm/messages in 15 servers of current date everyday and log it in one server. rsh is configured in all servers. The command I am using to accomplish this in shell script is rsh <remote sever> grep 'Jun 17'... (2 Replies)
Discussion started by: partha_bhunia
2 Replies

9. Solaris

Remove logs by date

Hi I Need To Remove Logs Older Than April 1 St(4/1/2007) By Date I Have A Script To Remove 3 Months Old Like Using 90 Days Thanks (3 Replies)
Discussion started by: cvdev
3 Replies

10. Shell Programming and Scripting

Remove out date logs

hi all, i would like to write the shell script to remove the out-dated log my log file name will be like this: access_20050101.log access_20050102.log . . . access_20071007.log access_20071008.log access_20071009.log i has try to write the command as following, it will be remove the... (2 Replies)
Discussion started by: eric_wong_ch
2 Replies
Login or Register to Ask a Question