in reply to column counter and printf question
Hello fasoli,
I want to ignore the first 12 lines...
If you know in advance that the number of lines to ignore is exactly 12, you can use the range operator in scalar context like this:
next if 1 .. 12;
(This works because it’s short for next if ($. == 1 .. $. == 12);) But:
In line 12, which is one line above where I want to start data copying, there is a unique pattern (@TYPE xy). I'd prefer to match this line and then tell the script to start copying from the next (13) line onwards.
In this case, change the range as follows:
while (<$input>) { next if 1 .. /\@TYPE xy/; printf ...; }
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: column counter and printf question
by fasoli (Beadle) on Oct 28, 2015 at 14:06 UTC | |
by Athanasius (Archbishop) on Oct 28, 2015 at 14:58 UTC |