From: Mike Jones on


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
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.