On Wed, Dec 24, 2008 at 03:03:08PM +0200, Dan Shimshoni wrote: > Thanks! > I want that the output will be be not the console, as it is by your > offer, but to the same file. > Namely , running the script on input.txt will delete a line in that > file so that after running the script,input.txt will be the same but > without line 5. > > It can be done by two lines following your suggestion thus: > > awk -v line_num=5 '{if(NR == line_num){next;} print $0;}' < input.txt > > output.txt > > mv output.txt input.txt
perl -ni -e 'print unless ($. == 5)' file_that_had_line_5.txt But this is cheating :-) See also s2p(1). -- Tzafrir Cohen | tzaf...@jabber.org | VIM is http://tzafrir.org.il | | a Mutt's tzaf...@cohens.org.il | | best ICQ# 16849754 | | friend ================================================================= To unsubscribe, send mail to linux-il-requ...@cs.huji.ac.il with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail linux-il-requ...@cs.huji.ac.il