Melissa Cama wrote:
> 
> Hi all,

Hello,

> I have the following data stored in a variable ($str_line), but I only
> need the usernames (ie the first column) from this information.  How do
> i extract just the user names?
> 
>         aragonm 172.24.142.136 aupoza528 (v1.1), start Thu 23/5 13:54
>         salibaj     172.24.142.136 aupoza528 (v1.1), start Thu 23/5 13:54
>         seniorb    172.24.142.136 aupoza528 (v1.1), start Thu 23/5 13:54
> 
> This is what I am currently using, but it just returns all the information.
> 
> my $user = (split (/\s+/), $str_line);


$ perl -le'
$str_line = q[salibaj     172.24.142.136 aupoza528 (v1.1), start Thu
23/5 13:54];
($name) = $str_line =~ /(\S+)/;
print $name;
$name = (split " ", $str_line)[0];
print $name;
'
salibaj
salibaj



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to