
ejhansen71
New User
Jun 23, 2009, 12:01 PM
Post #1 of 2
(3704 views)
|
Max Field Lengths for Delimited File
|
Can't Post
|
|
Hi - I am an intermediate / expert perl user and am about to write a program that fulfills the requirements below. However, before I start - I wanted to poll the perl experts out there to see if you know of an existing program or module that does this already. I've already spent a half day looking around to no avail. I want to create a file layout for a delimited file. Requirements: Take a delimited file (comma for simplicity) and output a result page that lists the field name and the maximum field length. There are variable number of fields (columns). There will be nothing in the csv changed or altered. The process should only analyze and output a newly created "file layout" that a client can use to create an optimally sized database or give correct information if they wanted to convert it to a fixed field file. The program must run on *nix and we are talking 100 million record files and up. File Example 1: abc,123,test1 def,1,testing2 Expected Output 1: FIELD1,3 FIELD2,3 FIELD3,8 File Example 2: abc,123,test1,toocool def,1,testing2,notsomuch Expected Output 2: FIELD1,3 FIELD2,3 FIELD3,8 FIELD4,9 It's pretty simple and I was hoping I wasn't the only person who needed such functionality. I'm tired of reinventing the wheel - so if anyone out there knows of a program they use or a module - I would appreciate it. Thx - Eric
|