merging 2 files
Richard Goerwitz
goer at sophist.uucp
Wed May 9 05:57:51 AEST 1990
On converting
><|FooBar
><|blaTZ
><|GRMblE
><|WhEe
into
><|FooBar foobar
><|blaTZ blatz
><|GRMblE grmble
><|WhEe whee
using the Perl script -
>< 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 ...).
If we are into the right-tool-for-the-job game, let me just point out
that Icon will do the same job as well:
procedure main()
every line := !&input
do write(line," ",map(line))
end
This'll run about the same speed as the Perl script.
The point is that there is no reason to perversely superimpose string-
processing tasks on a diverse set of utilities, when there exist inter-
nally consistent, fast, elegant (and free) methods for solving these
same problems.
-Richard L. Goerwitz goer%sophist at uchicago.bitnet
goer at sophist.uchicago.edu rutgers!oddjob!gide!sophist!goer
More information about the Comp.unix.questions
mailing list