I prefer Unix tools, bash scripts and sed in particular, for mining text files.
But most of my sed scripts are ad hoc and ran at the command line. But I needed to convert text extracted from PDF (gs) for import into a spreadsheet.
I had 21 invocations of sed
that started with:
sed -i 's/Ad\ ID\ //' $f
All the other scripts up to that point had run flawlessly so I was unprepared for:
sed: -e expression #1, char 73: unterminated `s' command
I love command line tools but error messages are not their strong point.
Disclosure: Yes, yes I did have an error in one of the sed regexes, but it was on line #15, not #1.
Ok, ok, laugh it up. The error message was correct because each line counts as a separate “expression #1.”
I did find the error but only by testing each regex.
Sed scripting tip: In a series of sed invocations, each invocation is “expression #1.”
Hope that saves you from looking for exotic problems with your sed distribution, interaction with your shell escapes, etc. (Yeah, all that and more.)