Re: Best way to grab lines n thru x of a file
- From: chas.owens@xxxxxxxxx (Chas. Owens)
- Date: Thu, 10 Apr 2008 12:54:06 -0400
On Thu, Apr 10, 2008 at 12:24 PM, Jonathan Mast
<jhmast.developer@xxxxxxxxx> wrote:
Hi, I have a ~125MB file of which I want to read lines n thru n+x and write
those into a separate file. What is the best way to go about this?
thanks
Use the flip-flop operator* (..):
perl -ne 'print if $. == 20 .. $. == 50' file
* http://perldoc.perl.org/perlop.html#Range-Operators
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
.
- Follow-Ups:
- Re: Best way to grab lines n thru x of a file
- From: John W. Krahn
- Re: Best way to grab lines n thru x of a file
- From: Jialin Li
- Re: Best way to grab lines n thru x of a file
- References:
- Best way to grab lines n thru x of a file
- From: Jonathan Mast
- Best way to grab lines n thru x of a file
- Prev by Date: Re: Best way to grab lines n thru x of a file
- Next by Date: Re: Best way to grab lines n thru x of a file
- Previous by thread: Re: Best way to grab lines n thru x of a file
- Next by thread: Re: Best way to grab lines n thru x of a file
- Index(es):