Article View: comp.unix.shell
Article #59Re: Need script (awk/sed/...) to remove dashes and do initial caps
From: Randal L. Schwartz
Date: Tue, 03 Nov 1992 19:00
Date: Tue, 03 Nov 1992 19:00
25 lines
1618 bytes
1618 bytes
In article <1992Nov2.195646.27860@spectrum.xerox.com> kris@xerox.com (Kris Schneider) writes: Here are some examples of what needs to be done: hello-world => HelloWorld helloworld => Helloworld HELLOWORLD => Helloworld HELLO-WORLD => HelloWorld In other words, the first charatcer should be capitalized, any character following a dash should be capitalized, all others should be lower case, and all dashes should be removed. I have an awk script that will grab the "field" I need, but I'm stuck from there. Any help you can provide is greatly appreciated. Thanks in advance... Since you didn't explicitly exclude *my* favorite data manipulation language, here's a Perl solution: perl -pe 's/[a-z]+/\u\L$&/ig; s/-//g;' <in >out Just another Perl hacker, -- Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095 merlyn@ora.com (semi-permanent) merlyn@reed.edu (for newsreading only) factoid: "Portland, Oregon, home of the California Raisins and Lone-Star Beer!"
Technical Details
Message-ID:
<MERLYN.92Nov3110054@romulus.reed.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!ogicse!reed!romulus!merlynReferences:
<1992Nov2.195646.27860@spectrum.xerox.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!reed!romulus!merlyn From: merlyn@ora.com (Randal L. Schwartz) Newsgroups: comp.unix.shell,comp.lang.misc Subject: Re: Need script (awk/sed/...) to remove dashes and do initial caps Message-ID: <MERLYN.92Nov3110054@romulus.reed.edu> Date: 3 Nov 92 19:00:59 GMT Article-I.D.: romulus.MERLYN.92Nov3110054 References: <1992Nov2.195646.27860@spectrum.xerox.com> Sender: news@reed.edu (USENET News System) Organization: Stonehenge Consulting Services; Portland, Oregon, USA Lines: 25 In-Reply-To: kris@xerox.com's message of 2 Nov 92 19:56:46 GMT