Message: previous - next
Month: July 2012

Re: [trinity-devel] Command to switch Q* to TQ*?

From: "David C. Rankin" <drankinatty@...>
Date: Sat, 28 Jul 2012 10:24:12 -0500
On 07/27/2012 04:57 PM, Robert Xu wrote:
> Hi all,
> Anyone have a handy sed command or similar to switch Q* to TQ* in patch files?
> I'm attempting to find the easiest way out before having to modify one
> by one individually.

  The issue you will have to look out for is those cases where it is just Qt or
TQt instead of Qt3, TQt3 (or whatever follows Q* and TQ*) In the stuff I have
done I find that some of the header checks still require the Q or TQ such that a
global change won't work (especially in the files). So keep a close
eye on what all is getting changed. As for the sed command, let's just build one
starting with:

sed -i 's|Qt|TQt|g' filename (or *.whatever)

  Then further tailor it with any further REGEX, lookahead/back and remembered
patters needed for the general file. Like when you are dealing with QT_VERSION
or QT_LICENSE and you only want those to go to TQT and no other Q* changes, then:

sed -i 's|QT_\([VL]\)|TQT_\1|g' filename (or *.whatever)

  Hopefully somebody else has more of a 'one size fits all' sed expression for
this, but I've always had to just look at what I was dealing with and then come
up with an expression that fit the bill. It might take 2 or 3 incremental sed
calls to get everything done.

David C. Rankin, J.D.,P.E.