Thanks for bearing with me Kirk. All keyword columns are necessary, starting with the column called Key50.
OK, so here is what you're going to do:
Open up Photo Mechanic and click on the Edit menu. Down near the bottom is the Settings sub-menu. Move your mouse cursor onto it and a sub-menu will appear. Choose 'Set Code Replacements...'
In the dialog that appears, click on the 'Add...' button and pick the text file that you prepared. Now at the bottom of the Code Replacement dialog is a field titled 'Delimiter character:' which by default is backslash ( \ ). If that is difficult for you to type then you can enter something else like the equals sign ( = ). For my examples I'll use backslash but if you use something else just substitute your preferred delimiter character wherever you see backslash being used.
Click the OK button in the Code Replacement dialog.
Back in the main window, open up a folder containing some of your images (but not all 20,000 at once, please!) Once you see your images appear, select one. Then from the Image menu, choose 'IPTC Stationery Pad...'
In the IPTC Stationery Pad dialog, click in the Caption field. Enter:
\{filename}#1\
If you already have captions in your photos and you don't want them wiped out, click on the '+' checkbox to the left of the Caption field. This will cause the new data to be appended to the existing data.
Next, click in the Keywords field. Enter:
\{filename}#2\ \{filename}#3\ \{filename}#4\
If you already have keywords in your photos and you don't want them wiped out, click on the '+' checkbox to the left of the Keywords field. This will cause the new data to be appended to the existing data.
If there is any other static information that you want to enter and have it applied, like Caption Writer (you) or Photographer enter it now in the appropriate fields.
If everything looks good, click on the 'Apply Stationery to Selected' button. Your single image should now have a caption and keywords (as long as its filename has an entry in your Code Replacement data).
You can verify this by moving your mouse over the photo and then clicking the 'i' button when it appears over your photo. This brings up the IPTC Info dialog and shows the IPTC and XMP metadata contained in your photo. If everything looks good then close the IPTC Info dialog. Select the rest of your images with Command-A and then Command-click on your first image to deselect it since it is complete and we don't want to double apply the data.
Once you have your selection setup, choose 'Apply IPTC Stationery Pad to Photos' command on the Image menu. Depending on how many images you have, this may take a few seconds or several minutes. When complete, your images should be all captioned and keyworded. You can spot check your metadata by clicking on the 'i' button which appears when you put your mouse cursor over an image.
Please let me know if you run into any trouble or don't understand any of my instructions.
-Kirk