If default-directory is a remote directory, shell-command (M-!) executes the command on the remote machine, but shell-command-on-region (M-|) executes it locally. This is more of a feature request rather than a bug report, but it might be nice if shell-command-on-region executed the command remotely as well. Or perhaps, a new command called something like 'shell-command-on-region-file' could be added that executed the command remotely. Thanks, best regards.