<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.26.3">
</HEAD>
<BODY>
On Wed, 2010-05-12 at 18:58 +0200, Jozsi Vadkan wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
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..:\

</PRE>
</BLOCKQUOTE>
<BR>
<BR>
Perhaps you need to redirect the output to the second file :)<BR>
<BR>
'&gt;' if you can overwrite the second file:<BR>
<BR>
sed -n '1,2p;4p' file.txt &gt; 2nd_file.txt<BR>
<BR>
 or &gt;&gt; if you want to append to it:<BR>
<BR>
sed -n '1,2p;4p' file.txt &gt;&gt; 2nd_file.txt<BR>
<BR>
<BR>
Cheers<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<BR>
<BR>
Calin<BR>
<BR>
Key fingerprint = 37B8 0DA5 9B2A 8554 FB2B 4145 5DC1 15DD A3EF E857<BR>
<BR>
=================================================<BR>
Things fall apart; the centre cannot hold.
</TD>
</TR>
</TABLE>
</BODY>
</HTML>