Bash - Xargs (Standard input command execution)

About

xargs is an utility that takes the output of a command (ie standard input in a stream) to create arguments and execute commands. This command does not take in general a stream as argument).

Example

  • remove file
find /path -type f -print | xargs rm
  • other example with hdfs
hdfs dfs -ls /path | grep -e pattern | awk '{print $8}' | xargs hdfs dfs -rm 

Powered by ComboStrap