Results 1 to 4 of 4
Hi all,
I would like to know if there is any way to remove commented lines ('#' ) from a file without opening it. I heard that this can be ...
- 11-30-2007 #1
removing lines with #
Hi all,
I would like to know if there is any way to remove commented lines ('#' ) from a file without opening it. I heard that this can be acheived using sed. I am not aware of it. Please let me know.
Any help would be appreciated.
Thanks.
- 11-30-2007 #2
I cant do SED (yet) but you might want to read:
http://www.student.northpark.edu/pem...d/sed1line.txt
This always helps me If I need something done Quickly.
- 11-30-2007 #3Just Joined!
- Join Date
- Nov 2007
- Location
- Salt Lake City, UT, USA
- Posts
- 32
will match any lines with # at beginning of line, but not if it is tabbed or spaced into the line.Code:sed -e '/^#/d' original.txt > new.txt
will match lines where # preceeded by any number of spaces at the beginning of the line.Code:sed -e '/^ *#/d' original.txt > new2.txt
I haven't yet dabbled in saving the file on the fly instead of writing a 2nd new file. Good luck!
- 12-01-2007 #4


Reply With Quote