in reply to how to extract certain lines

Please give an example of what you have tried so far. Your example test data is unclear; to clarify it, put <CODE> tags around your example code and example data.

Replies are listed 'Best First'.
Re^2: how to extract certain lines
by dee00zee (Novice) on Oct 26, 2004 at 03:19 UTC
    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;
      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