Re: only output the nth line

2010-05-14 Thread kalinix
On Wed, 2010-05-12 at 18:58 +0200, Jozsi Vadkan wrote: > I have a file: > > cat file.txt > daemon > 1): > 596 > 0 > 0 > 1 > 0 > 0 > bin > 2): > 12 > 0 > 0 > 1 > 0 > 0 > sys > 3): > 0 > 0 > 0 > 0 > 0 > 0 > > > > And i want to only output the first, second, and fourth line to another > file. >

Re: only output the nth line

2010-05-12 Thread birger
On Wed, 2010-05-12 at 20:07 +0300, Rares Aioanei wrote: > You can try some awk, methinks; I don't remeber how > to do it, but I say it's a good direction. awk 'NR == 1 || NR == 2 || NR == 4 { print }' < file.txt birger -- users mailing list users@lists.fedoraproject.org To unsubscribe or chang

Re: only output the nth line

2010-05-12 Thread Jake Peavy
On Wed, May 12, 2010 at 1:11 PM, Joachim Backes < joachim.bac...@rhrk.uni-kl.de> wrote: > On 05/12/10 18:58, Jozsi Vadkan wrote: > >> I have a file: >> >> cat file.txt >> daemon >> 1): >> 596 >> 0 >> 0 >> 1 >> 0 >> 0 >> bin >> 2): >> 12 >> 0 >> 0 >> 1 >> 0 >> 0 >> sys >> 3): >> 0 >> 0 >> 0 >> 0 >>

Re: only output the nth line

2010-05-12 Thread Patrick O'Callaghan
On Wed, 2010-05-12 at 18:58 +0200, Jozsi Vadkan wrote: > And i want to only output the first, second, and fourth line to > another > file. > > The: > > sed -n '1,2p;4p' file.txt > > doesn't work. Works for me. What does it do on your system? poc -- users mailing list users@lists.fedoraprojec

Re: only output the nth line

2010-05-12 Thread Joachim Backes
On 05/12/10 18:58, Jozsi Vadkan wrote: I have a file: cat file.txt daemon 1): 596 0 0 1 0 0 bin 2): 12 0 0 1 0 0 sys 3): 0 0 0 0 0 0 And i want to only output the first, second, and fourth line to another file. The: sed -n '1,2p;4p' file.txt doesn't work. What magic do i need for it? :D

Re: only output the nth line

2010-05-12 Thread Rares Aioanei
On Wed, 12 May 2010 18:58:56 +0200 Jozsi Vadkan wrote: > I have a file: > > cat file.txt > daemon > 1): > 596 > 0 > 0 > 1 > 0 > 0 > bin > 2): > 12 > 0 > 0 > 1 > 0 > 0 > sys > 3): > 0 > 0 > 0 > 0 > 0 > 0 > > > > And i want to only output the first, second, and fourth line to another > file. >

Re: only output the nth line

2010-05-12 Thread Bryn M. Reeves
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/12/2010 05:58 PM, Jozsi Vadkan wrote: > And i want to only output the first, second, and fourth line to another > file. > > The: > > sed -n '1,2p;4p' file.txt Works for me: $ sed -n '1,2p;4p' /tmp/t # t contains lines numbered 1, 2 etc. 1 2

only output the nth line

2010-05-12 Thread Jozsi Vadkan
I have a file: cat file.txt daemon 1): 596 0 0 1 0 0 bin 2): 12 0 0 1 0 0 sys 3): 0 0 0 0 0 0 And i want to only output the first, second, and fourth line to another file. The: sed -n '1,2p;4p' file.txt doesn't work. What magic do i need for it? :D Thanks..:\ -- users mailing list users@