Created
January 19, 2016 15:20
-
-
Save BibMartin/12244602ac0b1c5995c8 to your computer and use it in GitHub Desktop.
Using `xargs` and `sed` to apply a function to a set of files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Imagine you have a folder containing many files, and you want to apply a function to those files. | |
| ls *.ipynb | sed 's/.ipynb//' | xargs -i echo {}.ipynb-{}.log | |
| If you're in a folder containing `foo.ipynb`, `bar.ipynb`, 'baz.py`, you'll get: | |
| foo.ipynb-foo.log | |
| bar.ipynb-bar.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment