Perl: how to match between to points in a string

Discussion in 'Programming' started by recipe for..., Apr 28, 2008.

  1. #1
    My data is something like this:

    abc: words I don't want | words I want
    abc: remove these | more words I want
    abc: drop this | A few more important words
    abc: not these | Yes these too
    abc: delete this | and these as well
    ...

    Can I build a substitution that will remove the beginning stuff up to the pipe and leave every thing else? I have tried some wild card things like:

    $line =~ s/abc:.+|//;

    but that does not work. Can it be done?
     
    recipe for..., Apr 28, 2008 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    Do you have to use perl ? else you can use cut -d "|" -f.2
     
    it career, Apr 29, 2008 IP
    recipe for... likes this.
  3. recipe for...

    recipe for... Peon

    Messages:
    94
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I figured it out thanks for your input though!
     
    recipe for..., Apr 29, 2008 IP