in reply to Print 4 Lines below matching criteria
For something a little more verbose:
#!/usr/bin/perl -w use strict; while (<DATA>) { if (/^id:/) { my ($city, $phone, $street, $zip) = (<DATA>,<DATA>,<DATA>,<DAT +A>); print "$city$phone$street$zip"; } } __DATA__ John, Doe Michael id:1234567890123 library:ACME City, state:PUEBLO, CO Phone:719-555-555 Street:1610 Sorrow AVE APT D Zip: 81004
Prints:
City, state:PUEBLO, CO Phone:719-555-555 Street:1610 Sorrow AVE APT D Zip: 81004
Cheers,
Darren
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Print 4 Lines below matching criteria
by chromatic (Archbishop) on Nov 16, 2006 at 06:43 UTC | |
by jwkrahn (Abbot) on Nov 16, 2006 at 07:53 UTC | |
by BrowserUk (Patriarch) on Nov 16, 2006 at 08:37 UTC | |
by McDarren (Abbot) on Nov 16, 2006 at 08:19 UTC | |
|
Re^2: Print 4 Lines below matching criteria
by Anonymous Monk on Nov 16, 2006 at 23:33 UTC |