From: Mike Jones on 2 Aug 2010 19:24 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? XP alt.os.linux,alt.os.linux.slackware FU alt.os.linux -- *=( http://www.thedailymash.co.uk/ *=( For all your UK news needs.
From: Mike Jones on 3 Aug 2010 05:20 Responding to Mike Jones: > 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? > > sed 's/\([a-zA-Z0-9]*\)#.*/\1/g' -i file ....from J.O. Aho did the trick. Cheers guys! XP alt.os.linux,alt.os.linux.slackware FU alt.os.linux -- *=( http://www.thedailymash.co.uk/ *=( For all your UK news needs.
|
Pages: 1 Prev: wicd won.t run Next: Chromium browser for 13.1 on 13.0 - How to? |