Created
May 25, 2016 17:39
-
-
Save anonymous/84d635bc173bddd3555ddbf80e0921e5 to your computer and use it in GitHub Desktop.
fixed-to-tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# vim: noet ts=4 sw=4 | |
import io | |
import os | |
from glob import glob | |
INPUT_PATH = '/home/exchange/telxonExport/orders/buschs' | |
os.system("wget --reject ord99*.txt --mirror -A .txt -nH 'ftp://buschsxfer:00*Bu$ch$Xf3R*00@10.1.0.80' -P " + INPUT_PATH) | |
# Process a single filename | |
orderList = [] | |
for filename in glob(INPUT_PATH + '/*.txt'): | |
# Read the file, add an order to the list | |
with io.open(filename, "r", newline='') as orderIn: | |
data = orderIn.readlines() | |
for aline in data: | |
cusnum = aline[11:15] | |
productcode = aline[25:30] | |
qty = aline[30:33] | |
date = aline[15:21] | |
order = cusnum,'|00|',productcode,'|CS|',qty,'|',date | |
orderList.append(order) | |
with open(filename + '.mod', 'w+') as orderOut: | |
for entry in orderList: | |
orderOut.write((order) + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment