perl -wn000e # -n read file, 000 set $/ (input separator) to n +il # hence, read whole file into $_ '$start = 1034; # number of the line to start printing +at $end = 1047; # number of the line to end printing at $pre = $start - 1; # the number of lines to skip before pr +inting $len = $end - $start + 1; # the number of lines to print print / (?: # don't remember this () in $1..$n .*\n # all chars up to a newline and the \n ){$pre} # pre number of times ( # remember this (return it as first el of +list) (?: # but don't remember this part as 2nd elem +ent .*\n # match a line up to and including \n ){$len} # number-of-lines-to-print times ) # return as single (multi-line) value /mx' # /m: don't let '.' match \n (may not be n +ecessary)
In reply to Re: Re: Re: Simulating UNIX's "tail" in core Perl
by petral
in thread Simulating UNIX's "tail" in core Perl
by gryphon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |