[Chicago-talk] Regular expression
Andy Lester
andy at petdance.com
Wed Feb 6 10:50:53 PST 2008
On Feb 6, 2008, at 12:46 PM, Young, Darren wrote:
> Group Node Status
> -------------------- --------------- ------
> Cluster Group GSBDHCL2 Online <- the line
> I'm
> splitting on.
If they're fixed width columns, use unpack(), like so:
my ($group,undef,$node,undef,$status) = unpack( 'A20 A1 A15 A1 A6',
$str );
That's saying "Split out the first 20 alphas into $group, ignore the
next 1, the next 15 into $node, the next 1 ignored, and the last 6
into $status". You may need to adjust those widths, since I didn't
count carefully, but you get the idea.
xoxo,
Andy
--
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance
More information about the Chicago-talk
mailing list