merging 2 files

Arnold Robbins arnold at audiofax.com
Thu May 10 02:40:03 AEST 1990


The original job:

Convert

FooBar
blaTZ
GRMblE
WhEe

into

FooBar	foobar			
blaTZ	blatz
GRMblE	grmble
WhEe	whee

A perl script was suggested:
   chop;
   print $_, " ";
   y/A-Z/a-z/;
   print $_, "\n";

Rob McMahon (cudcv at warwick.ac.uk) writes:
I know perl is wonderful, and I do use it a lot, but I can't help feeling that
	tr '[A-Z]' '[a-z]' < file | lam file -s " " -
is easier (if you have `lam' I suppose, but there's an "if you have `perl'"
too ...).

goer at sophist.UUCP (Richard Goerwitz) presents an Icon solution:
procedure main()
  every line := !&input
  do write(line," ",map(line))
end

And, just for completeness, the following works in gawk and V.4 awk:

	{ print $1, tolower($1) }
-- 
Arnold Robbins -- Senior Research Scientist - AudioFAX | Laundry increases
2000 Powers Ferry Road, #220 / Marietta, GA. 30067     | exponentially in the
INTERNET: arnold at audiofax.com	Phone: +1 404 933 7600 | number of children.
UUCP:	  emory!audfax!arnold	Fax:   +1 404 933 7606 |   -- Miriam Robbins



More information about the Comp.unix.questions mailing list