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

Re: only output the nth line



TOFU fixed.  Please trim your replies to only the required context.

On Thursday 13 May 2010 11:34:53 Jozsi Vadkan wrote:
> 2010. 05. 13, csütörtök keltezéssel 11.04-kor Boyd Stephen Smith Jr. ezt
> 
> írta:
> > On Thursday 13 May 2010 10:49:22 Jozsi Vadkan wrote:
> > > 2010. 05. 12, szerda keltezéssel 12.25-kor Hugo Vanwoerkom ezt írta:
> > > > Jozsi Vadkan wrote:
> > > > > I have a file:
> > > > > And i want to only output the first, second, and fourth line to
> > > > > another file.
> > > >
> > > > hugo@debian:~$ sed -n '1,2p;4p' file.txt
> > >
> > > yes, that's the problem, it only outputs the first, second, and fourth
> > > line!
> >
> > I think that perhaps there is some language barrier.
> 
> oops, typo
> 
> I wanted to say that it only outputs the first, second, and fourht line
> _once_
> 
> so the 8th, etc lines are not in the output

Yes.  You didn't tell sed to do that.  You also didn't tell *us* you wanted 
that.  The key part is "etc." (i.e. "and others"), you never indicated you 
wanted anything other than the 1st, 2nd, and 4th lines.

So, what you want is every Nth line whenever N is a power of two?  Sounds like 
homework.  I already did my homework and have my degree; I don't intend to do 
yours.
-- 
Boyd Stephen Smith Jr.           	 ,= ,-_-. =.
bss@iguanasuicide.net            	((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy 	 `-'(. .)`-'
http://iguanasuicide.net/        	     \_/

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: