What constitutes a set of data? 
          Set 1:        54, 7 thru  9  
          Set 2:        54,19 thru 23

        or
          Set 1:        54, 7 thru 23

Wags ;)
-----Original Message-----
From: Kevin Old [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 15:19
To: [EMAIL PROTECTED]
Subject: Print data in sequential order


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:

open(FILE, "<$ARGV[0]");

while(<FILE>) {

        
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";
        }


Basically, I'm pulling out the data I need for each line and storing it
in a hash by the first column ($1) and then in the $2 place in the array
(corresponding to the second column).

The client wants the data to appear like the following:

      (First    Row) (Second   Row) 
Col1  Col2 Col3 Col4 Col2 Col3 Col4


So, using the first 2 records from the above data, it should look like
this:

54   7 CHAN 7 8 CHAN 7

Thing is, the number in Col2 is sequential.....meaning if 8 wasn't there
and 9 was, the data would look like this:

54  7 CHAN 7 {BLANK} {BLANK} {BLANK} 9 CHAN 7

The actual characters "{BLANK}" wouldnt' be there.  This data is going
to be comma delimited when it's done, so they final product would look
like:

54,7,CHAN,7,,,,9,CHAN,7

Now, I've got the data stored in the appropriate position in the array
in the hash....the record above would be like

$data{'54'}[7] = @("CHAN","7");
$data{'54'}[9] = @("CHAN","7");

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.


Any help is appreciated.


Thanks,
Kevin



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

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

Reply via email to