What are shell commands to narrow the file for certain hours or days. I think this can be done with the date arithmetic. If I am right, please let me know how can do arithmetic in date values.
All the nawks that I know don't have the mktime built-in function. But Corona688's solution works without mktime (just omit mktime and the surrounding parentheses) since the date values are in "yyyy mm dd hh mi ss" format which can be compared natively (you can omit all the spaces). mktime is needed if you want to compare two dates to see e.g. if they are within 10 seconds.
With a little modification:
Note, to compare the dates, all you need to do is arrange the values in year, month, day, hour, minute, second format. The "/"s and the ":"s don't matter as long as the digits are all the same widths and months are in numeric formats.
Last edited by binlib; 09-17-2011 at 09:30 AM..
Reason: Make month number two digits always.
These 2 Users Gave Thanks to binlib For This Post:
All the nawks that I know don't have the mktime built-in function. But Corona688's solution works without mktime (just omit mktime and the surrounding parentheses) since the date values are in "yyyy mm dd hh mi ss" format which can be compared natively (you can omit all the spaces).
Hi
Please would it be right to log the errors from a script running in cron in the following manner:
/datax/vendor/dump.sh > /datax/vendor/err.log 2>&1 (16 Replies)
How to check log size every 10min. by script (can use crontab)
if log size not change with alert "Log not update"
Base run on SunOS 5.8 Generic_Virtual sun4u sparc SUNW,SPARC-Enterprise
logFiles="log1.log log2.log"
logLocation="/usr/home/test/log/"
Out put.
Tue Jan 31... (3 Replies)
AM in need of some plugin/script that can monitor HP-UX file "/var/opt/resmon/log/event.log" .
Have written a scrip in sh shell that is working fine for syslog.log and mail.log as having standard format, have interrogated that to Nagios and is working as I required .
But same script failed to... (3 Replies)
I've been finding myself using a log file colorizer written in perl to reformat and colorize the output from many different programs. Mainly, however, I use it to make the output from "tail -f" commands more readable.
The base perl script I use is based on "colorlogs.pl" available from the... (1 Reply)
Hi
I have a requirement to write a script to capture all errors in a Logfile and send the file in email.
If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS.
So I created a Log file and put the Appropriate... (2 Replies)
Hi there all,
I have a little problem
I got a package called
epdp and I got 1 called pd (wich is Data Protector)
If I am writing a script to get the status of packages.
how can I get only the reply from dp?
Now if I do
cmviewcl -v |grep pdI get epdp and pd. (2 Replies)
Hi
I have go this alert_oss.log that is basically capturing all the oracle errorlogs.Now the problem is that it is one huge file and to see log of some particular date i tried
cat alert_oss.log | grep 'Mar 25 10:44:45 2007' > alert_25.txt
is not giving me the required output.
pls suggest
... (3 Replies)