sed question: lower-to-upper case
Maarten Litmaath
maart at cs.vu.nl
Tue Aug 8 05:03:34 AEST 1989
klein at mechp10.UUCP (Greg Klein) writes:
\I would like to use sed to change certain (not all) words in a text file
\from lower case to upper case. For example, the selected words to be
\changed might be all words that contain one or more lower case z's in
\them (like 'zebra'). Any ideas?
Sed is not very suitable for this task. :-(
Try the non-interactive variant of `ex' instead:
ex - file <<\+
%s/[a-zA-Z]*z[a-zA-Z]*/\U&/g
x
+
Explanation: substitute for every (maximal) sequence of letters, containing a
`z', its uppercase (`\U') `equivalent' (`&').
[`&' means: put here (a copy of) the string that was matched.]
--
"Mom! Eric Newton broke the day! In 24 |Maarten Litmaath @ VU Amsterdam:
parts!" (Mike Schmitt in misc.misc) |maart at cs.vu.nl, mcvax!botter!maart
More information about the Comp.unix.questions
mailing list