Skip to content

Instantly share code, notes, and snippets.

@sanmiguel
Created August 21, 2015 14:19
Show Gist options
  • Select an option

  • Save sanmiguel/089e8538a949df903f9b to your computer and use it in GitHub Desktop.

Select an option

Save sanmiguel/089e8538a949df903f9b to your computer and use it in GitHub Desktop.
sh-3.2$ find lib -name "*ex"
lib/bar baz.ex
lib/foo.ex
sh-3.2$ wc -l `find lib -name "*ex"`
wc: lib/bar: open: No such file or directory
wc: baz.ex: open: No such file or directory
19 lib/foo.ex
19 total
sh-3.2$ find lib -name "*ex" | xargs wc -l
wc: lib/bar: open: No such file or directory
wc: baz.ex: open: No such file or directory
19 lib/foo.ex
19 total
sh-3.2$ find lib -name "*ex" -print0 | xargs -0 wc -l
20 lib/bar baz.ex
19 lib/foo.ex
39 total
sh-3.2$ find lib -name "*ex" -exec wc -l {} +
20 lib/bar baz.ex
19 lib/foo.ex
39 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment