locked_user mr_leisure has asked for the wisdom of the Perl Monks concerning the following question:
The commandpost.log file has the following contents :#!/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 { } }
So the output from print is :[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
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.[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
this is still not finishedif ($mr_leisure) { bow; }
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reducing a line read into $_
by davorg (Chancellor) on Jan 04, 2001 at 14:56 UTC | |
|
Re (tilly) 1: Reducing a line read into $_
by tilly (Archbishop) on Jan 04, 2001 at 18:05 UTC | |
|
Re: Reducing a line read into $_
by salvadors (Pilgrim) on Jan 04, 2001 at 17:05 UTC | |
|
Re: Reducing a line read into $_
by I0 (Priest) on Jan 04, 2001 at 14:56 UTC | |
by Daniellek (Sexton) on Jan 04, 2001 at 15:18 UTC | |
by davorg (Chancellor) on Jan 04, 2001 at 15:24 UTC | |
by Daniellek (Sexton) on Jan 04, 2001 at 16:13 UTC | |
by repson (Chaplain) on Jan 04, 2001 at 16:55 UTC | |
| |
|
Re: Reducing a line read into $_
by clemburg (Curate) on Jan 04, 2001 at 17:54 UTC | |
|
Re: Reducing a line read into $_
by Fastolfe (Vicar) on Jan 05, 2001 at 01:20 UTC |