[Tfug] text file help

Don Freeman DFreeman at pagnet.org
Thu Jun 26 08:20:13 MST 2008


You can SDF it into a dbf file and manipulate it from there. I'm not
familiar with linux based data programs but once in a dbf it could be ported
to Access or most any common data format. 


Don W. Freeman
Special Projects Manager
Pima Association of Governments
177 N. Church Ave. #405
Tucson AZ 85701
(520) 792-1093 voice
(520) 620-6981 fax

-----Original Message-----
From: tfug-bounces at tfug.org [mailto:tfug-bounces at tfug.org] On Behalf Of
christopher floess
Sent: Thursday, June 26, 2008 6:25 AM
To: Tucson Free Unix Group
Subject: [Tfug] text file help

Alright, I imagine this to be at least in part a sed-type problem. I'd like
to try to figure it out on my own, but I'm on a time crunch here. I've got a
1300 page document that needs to be parsed and edited.

It's an inventory list of things in our warehouse that is the only record of
what we have here before a major software upgrade. It consists of a list of
locations and what they have in them. The problem is that if a location has
30 of one thing, that thing is listed 30 times.

I think the key to getting this file to a more manageable size is tallying
these items so that they are one line indicating the total quantity in that
location. Here's an
example:

Physical Inventory Detail Report for Univ. of Ariz. Bkst
                                                     Valued at Standard
Retail
 Date: 06/20/08                                   UNIVERSITY OF
ARIZONA BOOKSTORES                                       Page:  11
----------------------------------------------------------------------------
--------------------------------------------------------
PLU \ SKU            DESCRIPTION                               DCC
  QTY        COST    EXT COST
----------------------------------------------------------------------------
--------------------------------------------------------
Fixture #: 122


                                                      Area Total     585.84
   Area #: 13

883230063751         BELT A REVERSIBLE        /RED     /L      402008
    1       13.21       13.21
883230063805         BELT A REVERSIBLE        /RED/NVY /XL     402008
    1       13.41       13.41
883230063805         BELT A REVERSIBLE        /RED/NVY /XL     402008
    1       13.41       13.41
883230063751         BELT A REVERSIBLE        /RED     /L      402008
    1       13.21       13.21
883230063751         BELT A REVERSIBLE        /RED     /L      402008
    1       13.21       13.21
883230063751         BELT A REVERSIBLE        /RED     /L      402008
    1       13.21       13.21
883230063751         BELT A REVERSIBLE        /RED     /L      402008
    1       13.21       13.21
883230063751         BELT A REVERSIBLE        /RED     /L      402008
    1       13.21       13.21
883230063751         BELT A REVERSIBLE        /RED     /L      402008
    1       13.21       13.21
883230063805         BELT A REVERSIBLE        /RED/NVY /XL     402008
    1       13.41       13.41
883230063751         BELT A REVERSIBLE        /RED     /L      402008
    1       13.21       13.21
883230063744         BELT A REVERSIBLE        /RED/NVY /M      402008
    6       13.41       80.48
883230063805         BELT A REVERSIBLE        /RED/NVY /XL     402008
    6       13.41       80.48
883230063737         BELT A REVERSIBLE        /RED     /S      402008
    6       13.21       79.27

here you can see what's in fixture 122, area 13 and you can see item
#883230063751
is listed 6 times and in fact, the 6th column on any one of those lines is
the quantity that just happens to be 1 because when we count them, they get
tallied one at at time.

Those six lines could easily be written as one line like this:

883230063751         BELT A REVERSIBLE        /RED     /L      402008
    6       13.21       13.21

Notice how the 6th column now shows a quantity of 6. Well, that is what I
think the key is to reducing the size of this file is and I'm hoping someone
has a clever solution to it.

Another think to consider is that this item might be in two different
locations, for instance fixture 231, area 4 in that case, you could want the
total of what's in that location, but not a grand total of what's in both
locations. We need the fixtures to be independent of each other.

I think the sed part wouldn't come in until later when we need to resort
this in to a different order.

Any way, before I end this, I'll just say that his (my boss's) usual way to
do this is to open it with excel and then render it some how from there.
Unfortunately this time the file is bigger and exel keeps crashing when he
does it.

Thanks for any help

_______________________________________________
Tucson Free Unix Group - tfug at tfug.org
Subscription Options:
http://www.tfug.org/mailman/listinfo/tfug_tfug.org






More information about the tfug mailing list