Jul 7, 2005 #1 ozi403 Technical User Apr 29, 2002 54 0 0 TR How can I delete a line in a file from command prompt?
Jul 7, 2005 #2 Chacalinc Vendor Sep 2, 2003 2,043 0 0 US man sed sed 'Xn' file.txt where X is the line number. Cheers. Chacal, Inc. Upvote 0 Downvote
Jul 7, 2005 #3 Chacalinc Vendor Sep 2, 2003 2,043 0 0 US BTW, redirect the output to another file: sed '10d' file.txt > output.txt Cheers, Chacal, Inc. Upvote 0 Downvote
Jul 8, 2005 1 #4 p5wizard IS-IT--Management Apr 18, 2005 3,165 0 0 BE with ed you can edit the file in place, no need for another file (other than the temp copy ed will make for itself) delete line number 10 from file.txt from command line with an inline input document: ed file.txt <<eof_ed 10d w q eof_ed or a one-liner: echo "10d\nw\nq"|ed file.txt HTH, p5wizard Upvote 0 Downvote
with ed you can edit the file in place, no need for another file (other than the temp copy ed will make for itself) delete line number 10 from file.txt from command line with an inline input document: ed file.txt <<eof_ed 10d w q eof_ed or a one-liner: echo "10d\nw\nq"|ed file.txt HTH, p5wizard