假设我有一个文件,其中包含几百行内容,例如:
content.txt
包含以下格式的行
element1\n
element2\n
element3\n
...
在Linux中使用命令行可以运行一个Linux程序,文件中的每个元素减去它\n
作为参数
例如:
$ linuxCommand element1
$ linuxCommand element2
$ linuxCommand element3
$ linuxCommand ...
是的,使用xargs
:
xargs -l linuxCommand <content.txt
该-l
命令行选项限制参数的数目的每个调用linuxCommand
一个。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句