in reply to Re: Re: Simple perl one-liner for transforming text files
in thread Simple perl one-liner for transforming text files

A quick example of it in operation.

C:\test>type junk name: url1.domain1.com date: 2004/2/1 unwanted info: blah blah blah name: url2.domain5.org date: 2004/3/12 unwanted info: blah blah blah name: url1.domain1.com date: 2004/2/1 unwanted info: blah blah blah name: url2.domain5.org date: 2004/3/12 unwanted info: blah blah blah name: url1.domain1.com date: 2004/2/1 unwanted info: blah blah blah name: url2.domain5.org date: 2004/3/12 unwanted info: blah blah blah name: url1.domain1.com date: 2004/2/1 unwanted info: blah blah blah name: url2.domain5.org date: 2004/3/12 unwanted info: blah blah blah C:\test>perl -n000 -e" s[name: ([^\n]+)\ndate: ([^\n]+)\n.*][$1 $2]; c +homp; print qq[$_\n]; " <junk url1.domain1.com 2004/2/1 url2.domain5.org 2004/3/12 url1.domain1.com 2004/2/1 url2.domain5.org 2004/3/12 url1.domain1.com 2004/2/1 url2.domain5.org 2004/3/12 url1.domain1.com 2004/2/1 url2.domain5.org 2004/3/12 C:\test>

Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.