Hi. Me Again.
I am reading a text file and hoping to catch errors in it, and then send the error via an sms script i have to a mobile phone. The problem is, I would like to cut the line short. It may be easier to look at the code below...
#!/sbcimp/run/pkgs/gsbl/bin/perl -w
open (LOG,"commandpost.log) || die "Could not open file!\n";
foreach (<LOG>) {
if ($_ =~/CRITICAL/) {
print $_;
exec("call_sms_zh.pl -msg=$_");
} else {
}
}
The commandpost.log file has the following contents :
[Thu Jan 4 00:09:38 2001 27068]ln4p47dbs:Global_One:smartCopy:MAJOR:C
+all x84240 Couldn't copy STDERR to /gsbl3/UKCOPY/STDERR; Value too la
rge for defined data type
[Thu Jan 4 07:01:27 2001 1327]ln4p47dbs:Global_One:new_regext:CRITIC
+AL:Call x84240 Unable to put file; /global1/Global120010103.DAT_tmp
[Thu Jan 4 07:01:27 2001 1327]ln4p47dbs:Global_One:new_regext:MAJOR:
+Call x84240 Failed to transfer /global1/data/G1PRD/regext/UKWARB/Glob
al1.20010103.DAT to FCDREG_NT
[Thu Jan 4 08:04:36 2001 8489]ln4p47dbs:Global_One:rebook:MAJOR:Call
+ x84240 WARNING; GetOptions() error
So the output from print is :
[Thu Jan 4 07:01:27 2001 1327]ln4p47dbs:Global_One:new_regext:CRITIC
+AL:Call x84240 Unable to put file; /global1/Global120010103.DAT_tmp
Which should also become the -msg that is sent to the sms script. The problem is, the message is too long, so I was wondering how to cut some info out of the message? Perhaps the date and time in the square brackets(Thu Jan 4 07:01:27 2001 1327), as this will be re-applied on the sms message?
Any ideas you guys have will be greatly appreciated.
Thanks, ml.
if ($mr_leisure) { bow; }
this is still not finished