From: Robin Rosenberg Date: Tue, 05 Dec 2006 20:30:52 GMT Subject: Re: Diffs from CVS keyword expansion Message-ID: <200612052130.52247.robin.rosenberg.lists@dewire.com> In-Reply-To: <7v64cqglsm.fsf@assigned-by-dhcp.cox.net> tisdag 05 december 2006 20:55 skrev Junio C Hamano: > merlyn@stonehenge.com (Randal L. Schwartz) writes: > >>>>>> "Uwe" == Uwe Kleine-Koenig > >>>>>> writes: > > > > Uwe> #! /bin/sh > > Uwe> exec perl -i -p -e 's/\$(Id|Revision):.*?\$/\$$1: \$/' "$@"; > > > > Ow. My eyes hurt from that. How about we rewrite that as a native Perl > > script: > > > > #!/usr/bin/perl > > $^I = ""; # this is -i > > while (<>) { > > s/\$(Id|Revision):.*?\$/\$$1: \$/; > > print; > > } > > That's kinda surprising coming from the resident Perl guru. > > I am so used to the command line "-i -p" that I did not even > know what $^I does, and I would have lost without your "# this > is -i" comment. That alone makes the Uwe's one more readable > for me ;-). May I suggest a compromise? : #!/usr/bin/perl -i -p s/\$(Id|Revision):.*?\$/\$$1: \$/;