in reply to Re: how to extract certain lines
in thread how to extract certain lines

I want to extract from these data example: HERE IS THE DATA PLACED ABC; DO NOT ENTER PLACED BCD; HERE IS THE DATA PLACED ABC; WHO ARE U PLACED ABC;

Replies are listed 'Best First'.
Re^3: how to extract certain lines
by dee00zee (Novice) on Oct 26, 2004 at 03:21 UTC
    i type a few lines here but when i create, it becomes one long sentence?
      If it is all in one line, you could split it on the ; and do something like the following:

      while (<DATA>) { my @split=split/;/; foreach (@split) { if (/\bHERE IS THE DATA PLACED (\w+)/) { s/\bHERE IS THE DATA PLACED//; print $_; #print "Matched\n"; }else{ next; } } } __DATA__ HERE IS THE DATA PLACED ABC; DO NOT ENTER PLACED BCD; HERE IS THE DATA + PLACED ABC; WHO ARE U PLACED ABC ; __OUTPUT__ ABC ABC

      Neil

      the data im trying to type example
      HERE IS THE DATA
      PLACED ABC