Help Please - awk works directly but not in a script
Greetings,
I would like to deploy log monitoring in AIX, HP-UX, SUN Servers
# Saving the Last time stamp of the file
egrep "$(date +'%a %b %e %H:')" $ALOG |tail -1 >last_timestamp
awk -v T="$(<last_timestamp)" '/$T/,/ZZ/ {print $0}'< $ALOG
give me the following error:
awk: There is a regular expression error.
Invalid pattern.
The input line number is 1.
The source line number is 1.
If I do it directly, it works:
$cat last_timestamp
Wed Aug 30 15:36:19 2006
awk '/Wed Aug 30 15:33:36 2006/,/zz/ {print}'<$ALOG # It prints all
the info
Wed Aug 30 15:39:09 2006
Thread 1 advanced to log sequence 275604
Wed Aug 30 15:39:09 2006
Current log# 8 seq# 275604 mem# 0:
/u01/oradata/vrbhrpt/redolog_8a.ora
Wed Aug 30 15:39:09 2006
ARC0: Beginning to archive log# 1 seq# 275603
Current log# 8 seq# 275604 mem# 1:
/u02/oradata/vrbhrpt/redolog_8b.ora
Wed Aug 30 15:39:16 2006
ARC0: Completed archiving log# 1 seq# 275603
My goal is to run this script piping the above command to egrep (egrep
"ORA-") from cron every hour to catch errors errors (that start with
ORA-) and email/page.
I am saving the last timestamp, so that I can start with the next
second during my next run
so that I wont miss any lines in the log file for errors
Thank you for your help
BN
|