我试图在pipe
中使用mailx
命令,以便将某些消息传递给其他命令(例如awk
)以进行进一步处理。
pipe
命令文档指出:
Takes a message list and a shell command and pipes the messages through
the command. Without an argument, the current message is piped through
the command given by the cmd variable. If the page variable is set, every
message is followed by a formfeed character.
我正在尝试:
echo -e "f*\npipe awk '{ print \$1}'" | mail -N
应翻译为:
*
全部替换为特定的过滤器)awk
并打印第一个单词(无论用什么方式)。但是我得到了
No applicable messages from {awk}
我期望进行类似的处理:
> echo "a b c" | awk '{ print $1 }'
a