import csv
my_file_name = 'NVG.txt'
cleaned_file = 'cleanNVG.csv'
remove_words = ['INAC-EIM', '-INAC', 'TO-INAC', 'TO_INAC', 'SHIP_TO-inac',
    'SHIP_TOINAC']
with open(my_file_name, 'r', newline='') as infile:
    with open(cleaned_file, 'w', newline='') as outfile:
        writer = csv.writer(outfile)
cr = csv.reader(infile, delimiter='|')
writer.writerow(next(cr))
for line in cr:
    if not any(remove_word in element for element in line for remove_word in
        remove_words):
        line[1] = line[1][:5]
writer.writerow(line)
Reformat a column to only first 5 characters