dimchik has asked for the wisdom of the Perl Monks concerning the following question:
so i need everything up until the next entry. i was able to get it to work with the following perl script (the argument to the script is that 21-digit number)*** 2007-08-17 08:30:51 *** [UID] = 030318520070817083011 + followed by information, including line breaks and empty lines, rep +eat of the same 21-digit number, etc. *** 2007-08-17 09:25:17 *** [UID] = 030104220070817092407 + Reason = Web server error *** XML Request *** more data, line breaks, spaces, etc.
and now i need to get it to work as a single line command line script. I tried this, as well as many different variations but obviously without any luck:$badxml = `cat /mmf/log/BadXMLXact*`; $badxml =~ /@ARGV[0](.|\n)+/; $& =~ m/\*\*\*.*UID/; $output = $`; for ($output ) { s/\s{3,}/\n/g; } print $output;
your help is very much appreciated!perl -00 -nle 'print if /21-digit-number(.|\n)+(\*\*\*\.*UID)/'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: onle liner help needed
by holli (Abbot) on Aug 17, 2007 at 18:10 UTC | |
by dimchik (Initiate) on Aug 20, 2007 at 14:19 UTC | |
|
Re: onle liner help needed
by akho (Hermit) on Aug 17, 2007 at 16:37 UTC |