Xref: utzoo comp.unix.questions:30582 comp.lang.perl:5011 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!att!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal L. Schwartz) Newsgroups: comp.unix.questions,comp.lang.perl Subject: Re: need AWK help: lowercase, trim trailing spaces Keywords: awk Message-ID: <1991Apr21.015014.18228@iwarp.intel.com> Date: 21 Apr 91 01:50:14 GMT References: <1817@wjvax.UUCP> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal L. Schwartz) Followup-To: comp.unix.questions Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 24 In-Reply-To: mario@wjvax.UUCP (Mario Dona) In article <1817@wjvax.UUCP>, mario@wjvax (Mario Dona) writes: | HELP! I have a situation that just cries out for an awk solution, however | I'm at a loss over some minor, but important details. Well, to *me* it just cries out for a Perl solution. Try this: while (<>) { s/([A-Z]{3,})/\u\L$1$2/g; ($name,$address1,$address2,$city,$zip) = unpack("A10A19A17A24A*",$_); print "$name\n"; print "$address1\n"; print "$address2\n" if $address2; print "$city $zip\n"; print "\n"; } Works just fine on your test data. print "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: "Intel: putting the 'backward' in 'backward compatible'..."====/