From: Jozsi Vadkan on
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..:\


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/1273683537.12667.32.camel(a)localhost
From: Tzafrir Cohen on
On Wed, May 12, 2010 at 06:58:57PM +0200, Jozsi Vadkan wrote:
> I have a file:

[snip]

> 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..:\

Works just fine here:

$ nl /etc/fstab | sed -n '1,2p;4p'
1 # /etc/fstab: static file system information.
2 #
4 proc /proc proc defaults 0

0
$ nl /etc/fstab | busybox sed -n '1,2p;4p'
1 # /etc/fstab: static file system information.
2 #
4 proc /proc proc defaults 0

0


So please give some more details about your system (version of Debian,
version of sed, etc.). Also please tell us what actually happens when
you try to run it.

--
Tzafrir Cohen | tzafrir(a)jabber.org | VIM is
http://tzafrir.org.il | | a Mutt's
tzafrir(a)cohens.org.il | | best
tzafrir(a)debian.org | | friend


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/20100512171549.GU16560(a)pear.tzafrir.org.il
From: Aioanei Rares on
Cross-posting ain't nice, Jozsi...


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/4BEAE142.7050507(a)gmail.com
From: Mike Bird on
On Wed May 12 2010 09:58:57 Jozsi Vadkan wrote:
> sed -n '1,2p;4p' file.txt
>
> doesn't work.

Works for me in Lenny. What output do you see? What version
of sed do you have?

--Mike Bird


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/201005121011.44506.mgb-debian(a)yosemite.net
From: Hugo Vanwoerkom on
Jozsi Vadkan wrote:
> I have a file:
>
<snip>
>
>
> And i want to only output the first, second, and fourth line to another
> file.
>
> The:
>
> sed -n '1,2p;4p' file.txt
>

hugo(a)debian:~$ sed -n '1,2p;4p' file.txt
daemon
1):

0

ii sed 4.1.5-8 The GNU sed stream editor

Hugo


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/hseoac$iqd$1(a)dough.gmane.org