我有一个程序,该程序将不同的表格数据格式(列和列类型的数量)转储到Stdout中,理想情况下,我只想运行一次程序,将STDOUT拆分为多个流,因此我可以直接从流中读取CSV,而无需试图均质化均质化。表格数据或多次运行程序。
分析解答
对于少量输出,您可以使用支持/dev/fd/#
而不是GREP的尴尬:
dump_program |
awk '
/regex1/ { print > "/dev/fd/1" }
/regex2/ { print > "/dev/fd/2" }
/regex3/ { print > "/dev/fd/3" }
# ...
' \
1> >( process1 ) \
2> >( process2 ) \
3> >( process3 ) \
;