help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing arbitrary line range from files


From: Greg Wooledge
Subject: Re: Printing arbitrary line range from files
Date: Sun, 27 Jun 2021 23:10:19 -0400

On Mon, Jun 28, 2021 at 05:03:37AM +0200, lisa-asket@perso.be wrote:
> I want to print lines from files starting from line number "na" to line 
> number "nb".

https://mywiki.wooledge.org/BashFAQ/011

> Have written the following function, which uses head, but now want to extend 
> it to use
> 
> "sed" with "na" and "nb".

sed -n "$na,${nb}p"

(Various alternatives and optimizations are possible.  See the FAQ page.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]