Tidying up a text document

S

simonh

I have the following data which comes from exporting an Access
database. I'm not sure how the formatting will look (as there is no
preview post option), but basically I need to go from what you see
below to:

["Crimping Pliers", "Cerrti-lok Tyco 169400 Crimping Pliers",
"102956", "169406" ... etc]

or an array of hashes:

[{':Category => 'Crimping Pliers', :Description => "Cerrti-lok Tyco
169400 Crimping Pliers", etc... ]

-----------------------------------------------------------------

Category: Crimping Pliers

Item Description Item
Ref Alt' Ref Location User

Cerrti-lok Tyco 169400 Crimping Pliers
102956 169 406 Unit 9
D.Brown (D) Overdue

Crimping Pliers Amp Blue Handles
102098 Unit 5 S
Roddy
Crimping Pliers Amp Ho 602.
102394 Unit 9
B.Minion Overdue

Crimping Pliers Certi Lok 169400
102295 Unit 9
B.Minion
Crimping Pliers Pressmaster Rs 297-2979
101959 P025505 Unit 5 S
Roddy

Crimping Pliers Right Angle
101960 921053 Unit 9
A.Minion 00158 Overdue
Crimping Pliers Variocrimp P170935
101953 P170935 Unit 9
B.Minion

Dmc Af8 Crimping Tool M22520/1-01
102951 027242 Unit 5
S.Roddy

Dmc Crimper
102474 Unit 5
S.Roddy
Knipex Crimpers 97 52 36
102454 Unit 5
S.Roddy

Knipex Crimpers 97 52 36
102453 Unit 5
S.Roddy Overdue
Tyco Certi-lok Crimping Pliers
102533 Unit 9
B.Minion

Category: Dial Gauges

Item Description Item
Ref Alt' Ref Location User

0-1" Linear Dti
103346 Unit 10
J.Simms
0-1" Mitutoyo Dial Indicator
103056 Unit 15
A.Carlile

0-1" Mitutoyo Dial Indicator
103100 Unit 9
A.Mills

0-20mm Mitutoyo Dti
103345 KLC125 Unit 9
G.MacDonald
Dial Indicator
101728 Unit 1
M.Bowker

Draper Expert Dial Indicator 0-25mm 0.01mm
103018 Unit 4
G.Childs Overdue
Dti
102448 Unit 8
A.Hepple Overdue

Dti 0-1" Linear
102574 Unit 10
J.Simms Overdue
Dti Linear 0-1"
102565 Unit 1
A.Hepple Overdue

Dti Mitutoyo
102085 FLR453 Unit 15
A.Carlile
 
R

Ryan Davis

I have the following data which comes from exporting an Access
database. I'm not sure how the formatting will look (as there is no
preview post option), but basically I need to go from what you see
below to:

["Crimping Pliers", "Cerrti-lok Tyco 169400 Crimping Pliers",
"102956", "169406" ... etc]

or an array of hashes:

[{':Category => 'Crimping Pliers', :Description => "Cerrti-lok Tyco
169400 Crimping Pliers", etc... ]

hash = Hash[columns.zip(values)]

ri Hash::[]

and

ri Enumerable.zip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top