only output the nth line

Bryn M. Reeves bmr at redhat.com
Wed May 12 17:06:08 UTC 2010


-----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
4

$ sed -n '1,2p;4p' /tmp/file.txt # file from original post
daemon
1):
0

What goes wrong when you try it?

Regards,
Bryn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkvq4AAACgkQ6YSQoMYUY95SmQCggrNvJQSAVRTzo472isMDxyFR
RuIAoLDjeBJl6ahIMdJU6HGMAcYRruuv
=7btP
-----END PGP SIGNATURE-----


More information about the users mailing list