linux - Extract arguments from stdout and pipe -
i trying execute script n times different file argument each time using this:
ls /user/local/*.log | xargs script.pl
(script.pl accepts file name argument)
but script executed once. how resolve ? not doing correctly ?
ls /user/local/*.log | xargs -rn1 script.pl
i guess script expects 1 parameter, need tell xargs that.
passing -r helps if input list empty
note following is, in general, better:
find /user/local/ -maxdepth 1 -type f -name '*.log' -print0 | xargs -0rn1 script.pl
it handle quoting , directories safer.
to see xargs executes use -t
flag.
Comments
Post a Comment