by znpy · 8y ago · 0 comments
Trivial example:
ls -1 | xargs -L1 echo processing
I am finding it quite useful to load and delete a bunch of netapp volume snapshots in a single line: ssh netappuser@netapphost volume snapshot show $volname | awk '/selector_pattern/{print $1}' | xargs -L1 ssh netappuser@netapphost volume snapshot delete $volnamefind test -print0 | xargs -0 file
"This allows file names that contain newlines or other types of white space to be correctly interpreted by programs that process the find output. This option corresponds to the -0 option of xargs."
# remove files without spawning lots of rm processes
find . -name "*.xyz" -print0 -type f| perl -0 -ne 'chomp;print "$_\n";unlink;'