Jump to content

Parsing fixed-width fields in Ruby/Rails

simonstl's Photo
Posted Nov 06 2009 11:54 AM
4263 Views

I need to import a large table of data that arrives in fixed-width text format, and a few related smaller pieces that also come in different fixed-width formats.

I know that I can write a bit of code that unpacks lines based on an array of lengths, but is there anything more flexible out there? The smaller pieces in particular seem to change occasionally, and I'd rather not lock format details into code.

Tags:
1 Subscribe


1 Reply