Skip to content

Instantly share code, notes, and snippets.

@dbarowy
Last active February 5, 2016 16:08
Show Gist options
  • Save dbarowy/bdadc77dd17c7a39bb5e to your computer and use it in GitHub Desktop.
Save dbarowy/bdadc77dd17c7a39bb5e to your computer and use it in GitHub Desktop.
Remove suffix in UNIX find command
#!/bin/sh
find . -iname "*.foo" -exec basename "{}" .foo \;
# alternately, to feed that to another command
find . -iname "*.foo" -exec sh -c 'mycommand $(basename {} .foo)' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment