I work with tab-delimited files for a living. Because of the same need
you have, I created a Python script to do this. It has usage
information that is easy to follow (just run it without any
arguments).
I hope someone else finds this useful. I have, and use it every month.
It can be easily modifi
On Nov 5, 2:29 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
[snip]
> So you have a classic (especially for COBOL and older FORTRAN) fixed
> field record layout, no?
>
> I presume the entire file is of a single layout? That would mean
> only one splitting format is needed...
>
[s
> So you have a classic (especially for COBOL and older FORTRAN) fixed
> field record layout, no?
Exactly, I believe COBOL. It is a daily reconciliation with an
exchange and our system's orders. One of the problems of dealing with
these old legacy systems that never seem to go away
>
George Sakkis:
> Here's a general solution for fixed size records:
> >>> def slicer(*sizes):
>
> ... slices = len(sizes) * [None]
> ... start = 0
> ... for i,size in enumerate(sizes):
> ... stop = start+size
> ... slices[i] = slice(start,stop)
> ... start = stop
recno_idx = slice(0,10)
client_idx = slice(10, 11)
volume_idx = slice(11,11+10)
order_type_idx = slice(11+10, 11+10+3)
.
!? That seems to me confusingly far from a working solution,
at least in comparison to
recno_idex = the_line[0:10]
client_idx = the_li
[EMAIL PROTECTED] (Cameron Laird) writes:
> In article <[EMAIL PROTECTED]>,
> Tim Chase <[EMAIL PROTECTED]> wrote:
>>> I hope this is the right place to ask, but I am trying to come up with
>>> a way to parse each line of a file. Unfortunately, the file is neither
>>> comma, nor tab, nor space de
On Tue, Nov 4, 2008 at 11:45 AM, Tyler <[EMAIL PROTECTED]> wrote:
> Hello All:
>
> I hope this is the right place to ask, but I am trying to come up with
> a way to parse each line of a file. Unfortunately, the file is neither
> comma, nor tab, nor space delimited. Rather, the character locations
In article <[EMAIL PROTECTED]>,
Tim Chase <[EMAIL PROTECTED]> wrote:
>> I hope this is the right place to ask, but I am trying to come up with
>> a way to parse each line of a file. Unfortunately, the file is neither
>> comma, nor tab, nor space delimited. Rather, the character locations
>> imply
Wow! Thanks for the suggestions everyone.
Cheers,
t.
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 4, 11:45 am, Tyler <[EMAIL PROTECTED]> wrote:
> Hello All:
>
> I hope this is the right place to ask, but I am trying to come up with
> a way to parse each line of a file. Unfortunately, the file is neither
> comma, nor tab, nor space delimited. Rather, the character locations
> imply what
I hope this is the right place to ask, but I am trying to come up with
a way to parse each line of a file. Unfortunately, the file is neither
comma, nor tab, nor space delimited. Rather, the character locations
imply what field it is.
For example:
The first ten characters would be the record num
Tyler ha scritto:
Hello All:
I hope this is the right place to ask, but I am trying to come up with
a way to parse each line of a file. Unfortunately, the file is neither
comma, nor tab, nor space delimited. Rather, the character locations
imply what field it is.
For example:
The first ten cha
Hello All:
I hope this is the right place to ask, but I am trying to come up with
a way to parse each line of a file. Unfortunately, the file is neither
comma, nor tab, nor space delimited. Rather, the character locations
imply what field it is.
For example:
The first ten characters would be the
13 matches
Mail list logo