in reply to Getting lines in a file between two patterns
ie, as you can see it evaluates true (and in the example above it print because it evaluate true) only since 'start' is matched. It evaluates true until 'end' is matched, after 'end' is matched it evaluetes false.while (<FH>) { print if $_ =~ /start/../end/ }
means:if (101 .. 200) { print; }
Or, in words: 'print only line from 101 to 200'.if ($. == 101 .. $. == 200) { print; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getting lines in a file between two patterns
by Daikini (Initiate) on Oct 30, 2015 at 23:54 UTC | |
by 1nickt (Canon) on Oct 31, 2015 at 03:53 UTC | |
|
Re^2: Getting lines in a file between two patterns
by Daikini (Initiate) on Oct 30, 2015 at 16:50 UTC |