[ale] NewbieQ Perl filtering question
Mills, John M.
Mills.J at ems-t.com
Fri Jun 30 09:52:33 EDT 2006
Mike -
Closer and closer to what I want. Ideally I would like to plug this in
as an Apache 'Redirect', but I think the input line is too bizarre for
'httpd' to even try to look for it!
-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of Mike
To: ale at ale.org
Fletcher
On Jun 29, 2006, at 4:57 PM, Mills, John M. wrote:
> Input: blah..blah..string1<good content>string2..garbage..garbage
> Output: <good_content>
The one-liner from the command line version would be:
perl -lne '/string1(.*?)string2/ && print $1' infile > outfile
or to do it in-place (making a copy of the original infile in
infile.bak)
perl -i.bak -lne '/string1(.*?)string2/ && print $1' infile
More information about the Ale
mailing list