Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 1996 10:47:28 -0500
From:      "Garrett A. Wollman" <wollman@lcs.mit.edu>
To:        "Wes Santee" <wsantee@wsantee.oz.net>
Cc:        wollman@lcs.mit.edu (Garrett A. Wollman), questions@freebsd.org
Subject:   Re: cc in FreeBSD
Message-ID:  <9602231547.AA04011@halloran-eldar.lcs.mit.edu>
In-Reply-To: <199602230735.XAA00579@wsantee.oz.net>
References:  <9602221618.AA26868@halloran-eldar.lcs.mit.edu> <199602230735.XAA00579@wsantee.oz.net>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Thu, 22 Feb 1996 23:35:43 -0800 (PST), "Wes Santee" <wsantee@wsantee.oz.net> said:

>[I wrote:]
>> Nope.  Try this:
>> 
>> perl -spi.bak -e 's,//(.*)$,/*$1 */,' *.c
>> 

> You guys are simply amazing.  That's all there is to it.  Here I was
> being pretty glib about writing this in about 4 lines of Perl code and
> it comes back to me demonstrated in one.  Wow.  (I guess to be fair, 2
> of those lines were the equivilant of the '-p' switch which I didn't
> know about).  Good show!

Actually, it turns out that I had slightly mis-remembered; the `-s'
switch doesn't serve any useful purpose here.  So, a one-character
shorter form would be:

perl -pi.bak -e 's,//(.*)$,/*$1 */,' *.c

And, of course, don't forget that this will cause syntax errors if
ever a string or a C-style comment contains a literal `//' in it.
These should be easy to find, however.

-GAWollman

--
Garrett A. Wollman   | Shashish is simple, it's discreet, it's brief. ... 
wollman@lcs.mit.edu  | Shashish is the bonding of hearts in spite of distance.
Opinions not those of| It is a bond more powerful than absence.  We like people
MIT, LCS, ANA, or NSA| who like Shashish.  - Claude McKenzie + Florent Vollant



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9602231547.AA04011>