lpr <<- diff file1 file2
That's not any kind of shell syntax I've ever seen, and I doubt very highly it actually works the way you expect it to. Are you using a different shell; c-shell perhaps? We usually assume Linux
unless stated otherwise, so you should always mention it when you are using a non-standard environment.
In any case, the link you gave also appears to describe a standard here document, as used by bash and most other shells:
<tab>a block of text to send
<tab>to the command's stdin
This is not what you used above. Heredocs need two
identical end strings. And embedded commands don't automatically expand inside the heredoc either. They need to be placed in command substitution
Also, the extra "-
" on the heredoc only strips any leading
tabs off of the beginning of each line inside the heredoc, allowing you to indent the contents for better readability. It doesn't strip out any other tabs in the text.
grail's post used bash-specific process substitution
, btw, which wouldn't work in any other shell. You would have to use something like temporary files and named pipes to do it otherwise.
Finally, I'd recommend tr
instead of sed
for removing individual characters from text. It's the most common option for such things.