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

Very cool. After a bit of reading, I think I understand what you are doing... Does not seem to work for me (prints out every line) yet, maybe I mistyped something... Let me go through it again... Thanks !
  • Comment on Re: Re: Simple perl one-liner for transforming text files

Replies are listed 'Best First'.
Re: Re: Re: Simple perl one-liner for transforming text files
by BrowserUk (Patriarch) on Mar 05, 2003 at 21:18 UTC

    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.