Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Fixed Position Column Records

by jhourcle (Prior)
on Jul 22, 2007 at 20:02 UTC ( #628139=note: print w/replies, xml ) Need Help??

in reply to Fixed Position Column Records

My code appears to do fine for the first 3 cols of data, but the 4th and 5th cols are sometimes right-aligned which my code can not handle

Based on the sample data you've given, have you considered using multiple methods to process the line? If you can reliably determine where the 3rd column starts, then you can get columns 3 through 6 with a split on \s+.

Of course, this won't work if you have empty cells in your data, or if any of the cells in columns 3-6 have spaces in them.

Replies are listed 'Best First'.
Re^2: Fixed Position Column Records
by daseme (Beadle) on Jul 23, 2007 at 20:53 UTC
    Thank you for your reply. I am still very much a beginner at Perl and so unfortunately I am not clear on the approach you are suggesting. To give you an idea of where I am at skill-wise, I am still attempting to apply BrowserUK's suggested heuristic from above.
    I would certainly appreciate any pointers to help me understand your suggestion though.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://628139]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2021-07-23 21:53 GMT
Find Nodes?
    Voting Booth?

    No recent polls found