Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hectorperez/60c827edf1b1885d4ccb to your computer and use it in GitHub Desktop.
Save hectorperez/60c827edf1b1885d4ccb to your computer and use it in GitHub Desktop.
insert a comment on the top of all files with an extension in a directory
# If you want to add a comment to all files with an extension (e.g. ".rb"):
find . -maxdepth 1 -type f -name "*.rb" -exec sed -i '1i #comment' {} \;
# And recursive:
find . -type f -name "*.rb" -exec sed -i '1i #comment' {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment