Perlwannabe wrote: > > I have a text file that has various addresses in different formats. I > need to remove any items that are not part of the address so the output is > standard. Here is an example of the input file: > > Address:<tab>1234<sp>Mockingbird<sp>Lane<tab>City:<tab>Groton<tab>State:<tab>CT > Address:<tab>2933<sp>Hummingbird<tab>St.<tab>City:<tab>Groton<tab>State:<tab>CT > Address:<sp>4321<tab>Sparrow<sp>Ave.<tab>City:<tab>Groton<tab>State:<tab>CT > . . . > > What I want to do is get all of the data between Address: and City: and > strip the <tab> and replace with spaces. The only problem is that the > data between Address: and City: changes. What I want in the end is: > > Address:<tab>1234<sp>Mockingbird<sp>Lane<tab>City:<tab>Groton<tab>State:<tab>CT > Address:<tab>2933<sp>Hummingbird<sp>St.<tab>City:<tab>Groton<tab>State:<tab>CT > Address:<tab.4321<sp>Sparrow<sp>Ave.<tab>City:<tab>Groton<tab>State:<tab>CT > > (notice that any <tab> in the address itself is now a <sp> with <tab> both > before and after the address.) > > I know it involves using the s/// operator to both strip the tabs and > replace with <sp> but the problem is that it requires using an array for > each address...and that is what is creating problems for me.
s{ (?<=Address:\t) (.+?) (?=\tCity:) } { ( $a = $1 ) =~ tr/\t/ /; $a }ex; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]