IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Re: Can someone do my job for me? :-)
If it's truly fixed length, with no record separator:
#!/usr/bin/python\n\nbadchar = '\\n'\nreclen = 100\n\ninf = open('/home/anderson/corrupt.txt', 'r')\noutf = open('/home/anderson/fixed.txt', 'w')\n\nwhile 1:\n    rec = inf.read(reclen)\n    if rec == '': break\n\n    if rec[19] == badchar: rec = rec[:19] + ' ' + rec[20:]\n    if rec[20] == badchar: rec = rec[:20] + ' ' + rec[21:]\n    outf.write(rec)\n\ninf.close()\noutf.close()
Otherwise change the 100 to 101 on UNIX, 102 on Windows. Very rough, but it should get you there.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
Expand Edited by admin Feb. 28, 2005, 05:55:12 PM EST
New Might lose data
I'm a real naysayer today.

But anyways if bytes 20 and 21 sometimes have legitimate data, you'll overwrite them with spaces.

Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
New Overwriting is fine - it's a field we don't actually use.
(I know, I'm a typical user, putting in spec changes at the last minute...)
Two out of three people wonder where the other one is.
Expand Edited by Meerkat Feb. 28, 2005, 05:33:50 PM EST
New I try not to assume about such things
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
New Well, I changed it to check regardless.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
     Can someone do my job for me? :-) - (Meerkat) - (11)
         man tr -NT - (pwhysall) - (1)
             Only if there are no legitimate carriage returns -NT - (ben_tilly)
         Is there a record seperator? - (ben_tilly)
         Re: Can someone do my job for me? :-) - (admin) - (4)
             Might lose data - (ben_tilly) - (3)
                 Overwriting is fine - it's a field we don't actually use. - (Meerkat) - (2)
                     I try not to assume about such things -NT - (ben_tilly)
                     Well, I changed it to check regardless. -NT - (admin)
         You guys *all* rock! - (Meerkat)
         The Proper Way - (pwhysall) - (1)
             Perfect! :) -NT - (Meerkat)

Solar-powered!
59 ms