[olug] String parsing question
Sam Tetherow
tetherow at shwisp.net
Fri Oct 7 17:13:52 UTC 2005
Adam Haeder wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Don't care. Any of the above.
>
>- --
>Adam Haeder
>Vice President of Information Technology
>AIM Institute
>adamh at omaha.org
>(402) 345-5025 x115
>PGP Public key: http://www.haederfamily.org/pgp.html
>
>On Thu, 6 Oct 2005, Nick Veys wrote:
>
>
>
>>What are your language requirements? Perl, PHP, shell scripts?
>>
>>On 10/6/05, Adam Haeder <adamh at omaha.org> wrote:
>>
>>
>>>-----BEGIN PGP SIGNED MESSAGE-----
>>>Hash: SHA1
>>>
>>>Hail, all you regular expression gurus:
>>>
>>>What's the best (fastest) way to get from this string:
>>>
>>>User 1 <user1 at a.com>, User 2 <user2 at a.com>, User 3 <user3 at a.com>
>>>
>>>to this:
>>>
>>>user1 at a.com user2 at a.com user3 at a.com
>>>
>>>Consider that there could be x number of addresses on the line, so I can't
>>>always assume 3.
>>>
>>>I'm racking my brains against sed and haven't come up with anything
>>>workable yet. TIA
>>>
>>>- --
>>>Adam Haeder
>>>Vice President of Information Technology
>>>AIM Institute
>>>adamh at omaha.org
>>>(402) 345-5025 x115
>>>PGP Public key: http://www.haederfamily.org/pgp.html
>>>
>>>-----BEGIN PGP SIGNATURE-----
>>>Version: GnuPG v1.2.4 (GNU/Linux)
>>>
>>>iD8DBQFDRZ5CbHC3IXlHqBQRAnK0AJoC3izYLooFAFokFgP2215idzS21gCePiFi
>>>Ik3rvn1lnF7oF8JwEGOtYo8=
>>>=EHGV
>>>-----END PGP SIGNATURE-----
>>>_______________________________________________
>>>OLUG mailing list
>>>OLUG at olug.org
>>>http://lists.olug.org/mailman/listinfo/olug
>>>
>>>
>>>
>>_______________________________________________
>>OLUG mailing list
>>OLUG at olug.org
>>http://lists.olug.org/mailman/listinfo/olug
>>
>>
>>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.4 (GNU/Linux)
>
>iD8DBQFDRpEnbHC3IXlHqBQRAkjEAJ9KLp0ehho3U45OF7NGqDkQKhUnkQCaAsGk
>Gt1YZ1uCKXnJf+GzTerYGfc=
>=9mPm
>-----END PGP SIGNATURE-----
>_______________________________________________
>OLUG mailing list
>OLUG at olug.org
>http://lists.olug.org/mailman/listinfo/olug
>
>!DSPAM:43469219211231145218801!
>
>
>
>
Since Jay hasn't replied yet I'll give a perl version ;)
Quick and dirty, no data validation:
#!/usr/bin/perl
while(<STDIN>) {
$_=~s/[^<]*<([^>]*)>/$1 /g;
print;
}
More information about the OLUG
mailing list