Also, does anyone know of a similar project for Linux?
Also, does anyone know of a similar project for Linux?
tmp=/tmp/out
maim -s -u | tesseract - "$tmp"
# Remove empty lines
sed -ir '/^\s*$/d' "$tmp".txt
copyq add "$(cat "$tmp".txt)"
rm "$tmp".txt
rm "$tmp".txtr
tesseract insists on adding on txt extension and what I assume is some intermediary file txtr, making it awkward to use with mktemp. Probably explained in the manual which I skipped.But like others have said tesseract is not very reliable, at least with default settings -- it's common for it to add extra spaces or various single quotes, or omit spaces.
Abutting that "r" option against the "i" option is likely why you ended up with a file named .txtr and therefore implies that it did not actually hear the "-r" you intended
I've had the best luck picking an actual backup suffix such as "-i.bak" or "-i~" to keep BSD sed and GNU sed on the same page, although I've also seen scripts that go as far as "--version" sniffing and changing the actual invocation as "${SED_I} -E" type stuff
Woe unto those who write scripts as "sed -i -e /whatever/" since for half(?) of their users they'll end up with "somefile-e"