Coping alerrt log [message #330629] |
Mon, 30 June 2008 11:41  |
toshidas2000
Messages: 120 Registered: November 2005
|
Senior Member |
|
|
How do I copy one day of alertlog message to a file??
grep does not work, it just copies the date
|
|
|
|
Re: Coping alerrt log [message #330691 is a reply to message #330690] |
Mon, 30 June 2008 17:53  |
 |
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
>>.Any messages after last occurrence will not be considered.
Quoting myself
for the second scan to find last occurrence you may want to
use input date + one day and do head -1 instead of doing a tail.
bash-2.03$ cat somescript
start=`grep -n "$1" alert_lawp1.log | head -1 |awk -F":" '{print $1}'`
end=`grep -n "$2" alert_lawp1.log | head -1 |awk -F":" '{print $1"p"}'`
echo "Start line $start";
echo "End line $end";
sed -n $start,$end alert_lawp1.log > newLog
bash-2.03$ somescript "Fri Jun 27" "Sat Jun 28"
Start line 16800
End line 16912p
|
|
|