Thursday, February 20, 2014

find -exec vs xargs

# process line one at a time
$ find . -type f -name "*svn*" -exec echo '{}'    \;

# combines output into one line and process it as a whole
$ find . -type f -name "*svn*" -exec echo '{}'   +

# same as  +
$ find . -type f -name "*svn*" | xargs  echo

xargs is a command on Unix and most Unix-like operating systems used to build and execute command lines from standard input.
eg:
$ find . -type f -name "*svn*" | xargs   ls -ltr  

No comments:

Post a Comment