Kevin Old wrote at Tue, 30 Jul 2002 00:19:24 +0200:

> Hello all,
> 
> I have a client with data that looks like this:
> 
> Col1 Col2 Col3 Col4
>   54    7 CHAN    7  B   132  10757    N/A   WIDE  STAND  C 54    8 CHAN    7  A   
>111  10758 N/A 
>    WIDE  STAND  C 54    9 CHAN    7  B    90  10759    N/A   WIDE  STAND  C 54   19 
>CHAN    7
>    A    69  10763    N/A   WIDE  STAND  C 54   20 CHAN    7  B    48  10764    N/A   
>WIDE  STAND
>   C 54   22 CHAN    7  A    27  10765    N/A   WIDE  STAND  C 54   23 CHAN    7  B  
>1008  10766
>   N/A   WIDE EXTEND  C 72   10 CHAN    7  B    95    728    N/A   WIDE  STAND  C 72  
> 11 CHAN    7
>    A    74   1212    N/A   WIDE  STAND  C 72   12 CHAN    7  B    53   1213    N/A   
>WIDE  STAND
>   C 72   13 CHAN    7  A    32   1214    N/A   WIDE  STAND  C 72   15 CHAN    7  A   
>997   1216
>   N/A   WIDE EXTEND  C 72   23 CHAN    7  B   168    734    N/A   WIDE  STAND  C 72  
> 24 CHAN    7
>    A   147    735    N/A   WIDE  STAND  C
> 
> It needs to be chopped up and printed in a certain format.
> 
> What I have so far is this
> ...
> if ($_ =~
> 
>/^\s+(\d{2,3})\s+(\d{2,3})\s+\w+\s+(\d{1,2})\s+(\w)\s+(\d{3,5})\s+(\d{5,6})\s+\w+\s+(\w+)\s+(\w+)/)
> {
>                 print "$1 $2 $3 $4 $5 $6 $7 $8\n";
> 
>                 $data{$1}[$2] = "$3, $4, $5, $6, $7, $8";
>         }
>         }
>         }

Wouldn't a simple 
split ' ';
doesn't do the same like your regexp ?

> ...
> 
> Anyway, if you're still with me.....how would I print the commas for the 8th 
>position?
> 
> Hope I haven't confused you too much.  Let me know if I need to clarify something.

I wouldn't think about it.
Just use Text::CSV_XS from CPAN,
and it you can simple specify the fields.


Greetings,
Janek


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

Reply via email to