Re: Text file editing - remove trailing comments?
- From: stuart <deleteme@xxxxxxxxxxxxxxxx>
- Date: Tue, 03 Aug 2010 08:13:36 +0100
Mike Jones wrote:
I have a long file with more lines than I fancy manually editing, and need to cut all the added comments from any lines that have them.
ie:
line1
line2 # comments
line3
line4 # with notes
line5 # more stuff
...becomes
line1
line2
line3
line4
line5
Anybody got quick'n'simple technique for this kind of thing?
Load the file into vi and do command
:%s/#.*\n/^M/g
and all those comments disappear.
I get that ^M by doing Ctrl+v Ctrl+m
Stuart
.
- Follow-Ups:
- Re: Text file editing - remove trailing comments?
- From: Mike Jones
- Re: Text file editing - remove trailing comments?
- Prev by Date: Re: Text file editing - remove trailing comments?
- Next by Date: Re: Text file editing - remove trailing comments?
- Previous by thread: Re: Text file editing - remove trailing comments?
- Next by thread: Re: Text file editing - remove trailing comments?
- Index(es):
Relevant Pages
|