Bash - 我如何输出行然后管道并排到另一个命令?

时间:2016-06-06 06:04:22

标签: bash xargs

或许最好用一个例子来解释。我想这样做:

文件:

one
two
three

命令:

cat file | xargs -n1 show_square_of_stringed_number

输出:

one one
two four 
three nine

show_square_of_stringed_number two只返回four,只能接受一个参数。

不寻找show_square_of_stringed_number的实现,而是简单地如何在输出旁边回送管道(两个)的输入(四个)。

希望xargs内置此功能。无法使用tee <(show_square),因为它在整个列表上运行,而不是在单行上运行。

0 个答案:

没有答案