Emacs shell command on buffer
This works for me:
(defun shell-command-on-buffer (command)
(interactive "sShell command on buffer: ")
(shell-command-on-region (point-min) (point-max) command t))
This one has the advantage of using the "shell command" minibuffer history instead of the general minibuffer history.
(defun shell-command-on-buffer ()
(interactive)
(shell-command-on-region (point-min) (point-max) (read-shell-command "Shell command on buffer: ") t))