Just to explain a little more, the command line works from left to right, except when redirecting input. So, the reason your first one didn’t work is because it was taking OUTPUT mysql and sending it to sed, and also trying to redirect input to sed from the WAR.sql file.
In the second case, you use file redirection in mysql, except that you give it a command (sed in this case), which means that the shell probably tried to open a [nonexistent] file named 'sed' in the current directory. The following input redirection probably just confused him if the shell even got to the parsing.
I consider (and voted) the answer from gbacon as the simplest solution to achieve what I think you need.
source share