Hi,i have a text file,how do i parse it in to second file to display only locations names and their average price?

CARREG      MAKE    MODEL   COLOUR  LOCATIOn    PRICE       OWNERS  MILEAGE
09-L-1258   OPEL    ASTRA   SILVER  LIMERICK    12999       0   35000
01-D-7845   FORD    FOCUS   BLACK   LIMERICK    1500        3   85000
11-D-7425   NISSAN  ALMERA  WHITE   DUBLIN      21000       0   0
06-C-1758   PEUGEOT A306    SILVER  CORK        9999        2   58500
10-CE-63    HYUNDAI ACCENT  RED DUBLIN      18000       1   12250
11-D-8956   AUDI    A6  BLACK   DUBLIN      75000       0   0
08-W-1373   FORD    FOCUS   BLACK   CORK        7900        2   45989
04-DL-31    OPEL    CORSA   GREEN   CORK        1900        3   67900
10-LK-123   BMW X1  SILVER  DUBLIN      28700       1   14223
98-C-6661   FIAT    BRAVO   YELLOW  CORK        750     5   43900car
01-LK-98    RENALT  LAGUNA  GREEN   LIMERICK    995     2   159000
00-KK-1211  SEAT    IBIZA   RED DUBLIN      975     1   110000
11-D-1233   TOYOYA  AVENSIS GREY    DUBLIN      26999       0   0
11-D-1234   TOYOTA  AVENSIS BLACK   DUBLIN      26999       0   0
01-D-31     OPEL    CORSA   BLACK   CORK        1900        3   987
07-D-7845   FORD    FOCUS   BLACK   LIMERICK    6500        1   55000

Recommended Answers

All 3 Replies

One way to parse lines like that is to use String's split method with a one-or-more-blanks regex as the delimiter

Is there any examples to see how to manipulate with columns,to select locations and do calc ?

After the split you have each item in its own array member, so just index the array to get the field you want.
To get the average add up all the values and divide b the number of values.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.