One might argue that 'a-line-ending-in-a-number' isn't specific-enough, since someone might quickly put in a photo filename (like the sample 'DSC_1459' above) and if they left-off the '.JPG' extension, then *that* line would end with a number, '9', which would throw-off the regular, desired results provided by that line of Bash scripting.
So, to 'upgrade', let's focus on the 'fixed', *predictable* portions of any given entry, meaning the 'code block' at the end:
cat 220315_index | tr '\n' '~' | sed 's/[0-9]~~/&\n\n/g' | grep "$CODE~~$"
Just realized that the existing script lines don't really address the 'DSC_1459' issue above -- what if a line happens to end in a digit, followed by two carriage returns, within an entry? It would then be transformed into an undesired end-of-entry designation (the entry's 0-9 taxonomy-line digit followed by two tilde '~' characters) (*any* normally-unused character could be used instead of the tilde character).
So here's the fix, if you didn't happen to get to it before me:
Note the '|' 'pipe' character now as the very first character to be found, *necessarily* followed by a single digit, 0 through 9, and then two tilde characters -- this is now officially the 'end-of-entry' designation used based on the whole text file of entries, from top to bottom, however long or short.