Xref: utzoo comp.unix.questions:21946 comp.lang.perl:1249 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!usc!ucsd!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.questions,comp.lang.perl Subject: Re: merging 2 files Keywords: sed awk perl join Message-ID: <1990May4.004643.1994@iwarp.intel.com> Date: 4 May 90 00:46:43 GMT References: <757@sagpd1.UUCP> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 61 In-Reply-To: jharkins@sagpd1.UUCP (Jim Harkins) In article <757@sagpd1.UUCP>, jharkins@sagpd1 (Jim Harkins) writes: | I need to change a lot of words with mixed upper and lower case letters into | words of all lower case letters, from there I'm going to make a sed script | to actually modify the words in our source. So how do I make my list? | For example, I want to convert the list | | FooBar | blaTZ | GRMblE | WhEe | | into | | FooBar foobar | blaTZ blatz | GRMblE grmble | WhEe whee | | (from this second list it's trivial to create lines of sed commands like | '/FooBar/foobar/g', and there are around 800 words in my list) | | Right now I have 2 files, one with the upper/lower case names, the second | with just lower case names. I think I've been going down the wrong path | here though. I'm now thinking of using sed directly but I'm no sed wizard. | Join may also do the job but I'm having trouble deciphering the man page | and none of my experiments to date have remotely resembled what I'm after. | | So, has anyone got any advice (outside of having a flunky use vi :-)? | Thanks in advance. An all-in-one Perl solution... ################################################## snip snip #!/usr/local/bin/perl @names = split(/\n/, <) { eval $cmd; print; } ################################################## snip snip printf "%s", "Just another Perl hacker," -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/