From bsh20858@news.fhda.edu Wed Oct 9 01:24:35 1996 Path: fu-berlin.de!news.mathworks.com!news.PBI.net!nntp-hub2.barrnet.net!su-news-feed4.bbnplanet.com!tiptoe.fhda.edu!bsh20858 From: bsh20858@news.fhda.edu (Brian S Hiles) Newsgroups: comp.editors,comp.unix.programmer,comp.unix.shell Subject: Re: sed, capitalize words. loopless script Followup-To: comp.editors,comp.unix.programmer,comp.unix.shell Date: 8 Oct 1996 22:56:55 GMT Organization: Foothill DeAnza College District Lines: 33 Distribution: inet Message-ID: <53em7n$jm2@tiptoe.fhda.edu> References: NNTP-Posting-Host: challenger.atc.fhda.edu X-Newsreader: TIN [version 1.2 PL2] Xref: fu-berlin.de comp.editors:21024 comp.unix.programmer:50132 comp.unix.shell:42162 Al Aab (af137@torfree.net) wrote: : the following sed script was tested with msdos sed15, a more friendly/ : extended sed. [sed script deleted] No, no, Al! If one wishes to capitalize a given given (first character) of input: sed ' h s/^\(.\).*$/\1/ y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/ x s/^.// H x s/\n// ' The "s" command, since it always involves a NFA (non-determinant finite automaton) is very CPU intensive, and its use should be minimized if at all possible. The above has the additional property of being quite flexible. (However, ex -sc '%s/.*/\u&/|wq' is still the solution that should be used.) -Brian -- ,---. ,---. ,---. ,---. ,---. ,---. ,---. / _ \ / _ \ / _ \ / _ \ / _ \ / _ \ / _ \ .' / \ `.' / mailto:bsh20858@challenger.atc.fhda.edu \ `.' / \ `. __,' `.___,' `.___,' `.___,' `.___,' `.___,' `.___,' `.__