Skip to content

Instantly share code, notes, and snippets.

@robmiller
Created January 27, 2014 16:03
Show Gist options
  • Save robmiller/8651287 to your computer and use it in GitHub Desktop.
Save robmiller/8651287 to your computer and use it in GitHub Desktop.
Prepend line to files in shell
# requires sponge, from joey hess's moreutils
# http://joeyh.name/code/moreutils/
for i in *.txt; do; echo "line to prepend\n" "$(cat $i)" | sponge $i; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment