Skip to content

Instantly share code, notes, and snippets.

@BibMartin
Created January 19, 2016 15:20
Show Gist options
  • Select an option

  • Save BibMartin/12244602ac0b1c5995c8 to your computer and use it in GitHub Desktop.

Select an option

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
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