Interpret this way, let's use the kill command as the first example:
Let's say the output of the command "cat /tmp/server.pid" is something like "3193". As you did the first time, your command with pipe + kill would look something like: "3193 kill -9"; however we know that this will not work, because we have to execute the command "kill -9" followed by a parameter, in the case of the pid of the process we want to terminate; so the correct thing would be to turn this parameter into a variable, which is not possible with the use of the pipe, as it is used to "concatenate" and / or redirect commands.
The way you use the pipe depends exclusively on how you organize your commands, see:
"As a Linux beginner, I realized the relevance of the pipe to make shell commands more practical and easier to write and porting. I decided to share my experience with this command.
The pipe is one of the ways Linux can use for inter-process communication. In a simplistic way we could say that the pipe is nothing more than the thread of processes. At first glance the pipe may not attract attention from beginners, but it is a very powerful tool. This process thread can be activated by the user through the "|" command. Now let's demonstrate in the example below the potentiality of this tool:
$ ls | grep b | sort -r | tee file.out | wc -l
- The "ls" command, as we all know, lists the contents of the directory,
but due to the pipe it does not send the result to the screen,
command "grep b".
- The "grep b" command in turn filters the names of
files containing the letter "b". Due to the second pipe the
command "grep b" is sent to "sort -r", which sorts the names in
increasing order.
- The output of "sort -r" is then passed to the command
"tee", which divides the data into two, as if it were a connection in t,
causing the information processed by the command "sort -r"
are written in the file "file.out".
- Then the command "wc -l"
the lines of the file "file.out". Thus we obtain as
result the number of files that contain the letter "b" printed on the
screen and the name of these files in "file.out".
(...)
Reference: Using the pipe