Re: An Odd Little Script

2005-03-10 Thread Nick Craig-Wood
Terry Hancock <[EMAIL PROTECTED]> wrote: > The only problem I see is the "in place" requirement, which seems silly > unless by "quite large" you mean multiple gigabytes. Surely Perl > actually makes a copy in the process even though you never see > it? If using "perl -i" then then it does mak

Re: An Odd Little Script

2005-03-09 Thread Michael Hoffman
Michael Hoffman wrote: Greg Lindstrom wrote: I have a file with varying length records. All but the first record, that is; it's always 107 bytes long. What I would like to do is strip out all linefeeds from the file, read the character in position 107 (the end of segment delimiter) and then re

Re: An Odd Little Script

2005-03-09 Thread Benji York
Greg Lindstrom wrote: I have a task which -- dare I say -- would be easy in Perl but would rather do in Python (our primary language at Novasys). I have a file with varying length records. All but the first record, that is; it's always 107 bytes long. I intuit that you are dealing with EDI

Re: An Odd Little Script

2005-03-09 Thread M.E.Farmer
Greg Lindstrom wrote: > Hello- > > I have a task which -- dare I say -- would be easy in > Perl but would rather do in Python (our primary > language at Novasys). I have a file with varying length records. All > but the first record, that is; it's always 107 bytes long. What I would > like to d

Re: An Odd Little Script

2005-03-09 Thread James Stroud
This might be hack-ish, more elegant solutions are likely to exist, but this is the general idea: LINEFEED = "\n" # or whatever EOR = "?"# or whatever def fixEOR(filename): f = open(filename,"r+") byte = True # loops through whole file while True: # loops through record

Re: An Odd Little Script

2005-03-09 Thread Terry Hancock
On Wednesday 09 March 2005 04:06 pm, Greg Lindstrom wrote: > Hello- > > I have a task which -- dare I say -- would be easy in > Perl but would rather do in Python (our primary > language at Novasys). I have a file with varying length records. All > but the first record, that is; it's always

Re: An Odd Little Script

2005-03-09 Thread Michael Hoffman
Greg Lindstrom wrote: I have a file with varying length records. All but the first record, that is; it's always 107 bytes long. What I would like to do is strip out all linefeeds from the file, read the character in position 107 (the end of segment delimiter) and then replace all of the end o

An Odd Little Script

2005-03-09 Thread Greg Lindstrom
Hello- I have a task which -- dare I say -- would be easy in Perl but would rather do in Python (our primary language at Novasys). I have a file with varying length records. All but the first record, that is; it's always 107 bytes long. What I would like to do is strip out all linefeeds fr