我想做:
cat a.txt |\ awk '{ if ($1>0) { print $0 } else { print $0 | "cat 1>&3" } }' 1>(awk '{print $0"positive"}') 3>(awk '{[print $0"zero or negative"}')
这个想法是我想分别处理来自同一个命令的两个输出。这可能吗?怎么做?不推荐吗?谢谢你,谢谢!
ubbxdtey1#
awk '$1 > 0 {print $0"positive"}' <a.txt >p.txt & # process A awk '$1 < 0 {print $0"negative"}' <a.txt >n.txt & # process B
2个进程,文件被读取两次,可能是缓冲的。您的示例将包含相同数量的读取,但有3个进程。
1条答案
按热度按时间ubbxdtey1#
2个进程,文件被读取两次,可能是缓冲的。您的示例将包含相同数量的读取,但有3个进程。