开发者

xargs and ex command input

开发者 https://www.devze.com 2023-02-14 20:12 出处:网络
Can someone explain why when attempting to run an ex command script on a number of files, this works:

Can someone explain why when attempting to run an ex command script on a number of files, this works:

for x in `ls *`;do ex $x <excmds;done;

but this doesn't:

ls *|xargs 开发者_如何学Go-i ex {} <excmds

The first will execute ex and run commands in "excmds" for each file The second, I'm not sure what it does, but it doesn't change any files. I'm guessing the re-direct is a problem, and doesn't act on each execution of xargs? Is there some way to do it with xargs? (yet another question I've raised on xargs - maybe I should stop using it :( )


Use GNU Parallel:

ls * | parallel ex {} \<excmds

Watch the intro video to learn more: http://www.youtube.com/watch?v=OpaiGYxkSuQ

10 seconds installation:

wget pi.dk/3 -qO - | sh -x
0

精彩评论

暂无评论...
验证码 换一张
取 消