On Fri, Dec 08, 2000 at 01:07:17AM +0000 or so it is rumoured hereabouts,
Smelly Pooh thought:
> In reply to John McCormac's flatulent wordings,
> >
> >
> > On Thu, 7 Dec 2000, Michael Turley wrote:
> >
> > > Does anyone know of a utility to strip C style (/* */)
> > > comments from code. I have a rake of stuff with alot
> > > of CVSg material which I would like to remove. Does
> > > CVS have this type of functionality?
> >
> > You could try something along the lines of:
> >
> > perl -p -i.bak -e 's/oldstring/newstring/g' filename
> >
> > The incantation for the comments would be something along the lines of
> > [\/*][a-zA-Z0-9-.,]*[*\/] though that may blow the machine up and do
> > irreprable harm. Perhaps some of the Regexp experts here could give the
> > right incantation.
>> cpp will strip comments, but also add stuff in include files
>> perl wise...
>> perl -n -e 'print unless (/\/\*/ .. /\*\//)' filename
>> should do fine
>Will that work across lines also (since you can use comments of the form
/* First line
* Second line
* Last line */
)?
--
Conor Daly <conor.daly at oceanfree.net>
Domestic Sysadmin :-)
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!