merging 2 files

Tom Christiansen tchrist at convex.COM
Fri May 4 15:24:00 AEST 1990


In article <757 at sagpd1.UUCP> jharkins at sagpd1.UUCP (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.

Just for the record, I really did play around with sed's y operator a bit
and swapping pattern and hold spaces before throwing up my hands and doing
it the easy way.  Use

    % perl -n foo.pl

where foo.pl consists of:

    chop;
    print $_, " ";
    y/A-Z/a-z/;
    print $_, "\n";

I'm not sure how you plan to merge two files, but I think it'll end up
being easier in perl than in sed.

--tom
--

    Tom Christiansen                       {uunet,uiucdcs,sun}!convex!tchrist 
    Convex Computer Corporation                            tchrist at convex.COM
		 "EMACS belongs in <sys/errno.h>: Editor too big!"



More information about the Comp.unix.questions mailing list