On Wed, 15 Jan 2014 19:11:56 -0600
"Darrell Anderson" <darrella(a)hushmail.com> wrote:
>I would like to inspect source tree text strings
for instances
of
KDE/kde
rebranding issues and update to TDE/tde. Mostly in
tooltips
and What's This help strings. My challenge is being able to
efficiently grep only those strings, which often in the sources
are multiple lines.
I would appreciate shell scripting advice to find such text
strings.
Nobody knows?
It would help to search whole words - grep option '-w'?
I don't understand how that helps. For example, I want to find all
TQWhatsThis strings, which often are multiple lines, and ensure I
am searching the entire string, which includes all the multiple
lines. About the only thing I know is the search will key on
something like TQWhatsThis and the entire glob of text to search
will end with an apostrophe (;). All of that constitutes the entire
string that must be searched for 'KDE/kde'.
I think people may have misinterpreted your use of the word "efficiently"
in the original post to mean that you had the basics worked out and
were just worried about the run time (I know I did).
I don't think you can do this with grep, which operates primarily on
lines, unless you want to use shell script to read in each file and
concatenate the lines together without CR characters, then run grep
on the result. Much easier to forget about shell scripting and do it in
Perl, in which case you need to recurse across the directory tree,
slurp in entire files, run each through a regular expression match
like (from your example, and assuming you meant "semicolon" where
you wrote "apostrophe"):
/(TQWhatsThis.*?kde.*?\;)/gim
and print out the matches.
E. Liddell