This script will convert Fixed width File into Delimiter File, tried on Python 3.5 only
Sample run: (Order of argument doesnt matter)
python ConvertFixedToDelimiter.py -i SrcFile.txt -o TrgFile.txt -c Config.txt -d "|"
Inputs are as follows
-
Input FIle - Mandatory(Argument -i) - File which has fixed Width data in it
-
Config File - Optional (Argument -c, if not provided will look for Config.txt file on same path, if not present script will not run) Should have format as FieldName,fieldLength eg: FirstName,10 SecondName,8 Address,30 etc:
-
Output File - Optional (Argument -o, if not provided will be used as InputFIleName plus Delimited.txt)
-
Delimiter - Optional (Argument -d, if not provided default value is "|" (pipe))