Marc M Dawson wrote:
> I am supposed to parse a text file such as this-
> 781457 Hartanto Victor Setiawan <[EMAIL PROTECTED]>
> 777557 Hatfield Benjamin <[EMAIL PROTECTED]>
> 779777 Henry James <[EMAIL PROTECTED]>
> 777947 Hergert Michael William <[EMAIL PROTECTED]>
> 778097 Iverson Jennifer
> I am supposed to parse a text file such as this-
> 781457 Hartanto Victor Setiawan <[EMAIL PROTECTED]>
> 777557 Hatfield Benjamin <[EMAIL PROTECTED]>
> 779777 Henry James <[EMAIL PROTECTED]>
> 777947 Hergert Michael William <[EMAIL PROTECTED]>
> 778097 Iverson Jennifer Marsee <[EMAIL PROTEC
Hi,
This works, even if it's not the most elegant.
open LIST, ") {
@details = split /\s+/, $line;
if (@details == 5) {#test for length of array
$details[2] .= " ";
$details[2] .= $details[3]; #put middle name in with 1st name
splice @details, 3, 1; #get rid o
On Monday, May 6, 2002, at 05:45 , Marc M Dawson wrote:
> I am supposed to parse a text file such as this-
> 781457 Hartanto Victor Setiawan <[EMAIL PROTECTED]>
> 777557 Hatfield Benjamin <[EMAIL PROTECTED]>
> 779777 Henry James <[EMAIL PROTECTED]>
> 777947 Hergert Michael William <[EMAIL PR
Here's one way with a regex:
open(INFILE,"myfile.txt") || die "Could not open myfile.txt!\n";
while(){
$_ =~ /^(\d{6})\s+(\w+\s*\w*)\s+(\w+)\s+(<.+\@.+>)\s*$/ || die "Improper
format";
$index = $1;
$firstmaybemiddle = $2;
$last = $3;
$smtpaddr = $4;
}
Now I haven't had a chance
Subject: Re: Ok- real dumb question
>
>
> why a 'split'
>
> If you only want the 'full user name' why not simple:
>
> while ( ) {
> /^\s*\d+\s*([\w\s]+)\
> my $person = $1;
> print "found :$person\n";
&g
Then you'll be tarred and feathered and run out on a rail. :)
-Original Message-
From: Nikola Janceski
To: '[EMAIL PROTECTED]'
Sent: 5/7/02 8:33 AM
Subject: RE: Ok- real dumb question
What if I change my name to a symbol (like the artist formerly known as
Prince)?
So
| > What if I change my name to a symbol (like the artist formerly
| > known as Prince)?
| >
| > Some ideas for my new name:
| > rm -rf *
| > /dev/null
| > pop @women
| >
| Then you'll be tarred and feathered and run out on a rail. :)
Too much validation in a single regular expression is a bad t
On Tuesday, May 7, 2002, at 08:23 , Timothy Johnson wrote:
> Here's one way with a regex:
>
> open(INFILE,"myfile.txt") || die "Could not open myfile.txt!\n";
> while(){
>$_ =~ /^(\d{6})\s+(\w+\s*\w*)\s+(\w+)\s+(<.+\@.+>)\s*$/ || die
> "Improper
> format";
>$index = $1;
>$firstmaybe
On Tuesday, May 7, 2002, at 11:07 AM, drieux wrote:
>
>
shouldn't that be:
> ciao
> drieux
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
10 matches
Mail list logo