need AWK help: lowercase, trim trailing spaces
Randal L. Schwartz
merlyn at iwarp.intel.com
Sun Apr 21 11:50:14 AEST 1991
In article <1817 at wjvax.UUCP>, mario at 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 at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/
More information about the Comp.unix.questions
mailing list