Shell Magics
xargs
xargs pipes output of previous command as list of input to next command.
What we can do is for each output from previous we can execute perticular command.
Example to move all files in a given folder to a subfolder inside.
ls -a | grep -v new_path | xargs -I % sh -c "mv % new_path"
Magics Revealed:
ls -a | grep -v new_path
ignores just new_path and puts rest into out stream.ls -a | grep -v new_path | xargs -I
now xargs -I % puts each ouput line into variable%
to refer in futher steps.sh -c "command"
will start new subshell and executescommand