Skip to content

Instantly share code, notes, and snippets.

@gregdeane
Created January 4, 2017 11:34
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 gregdeane/28f0f26ad5aa3f8f08a9be323284579d to your computer and use it in GitHub Desktop.
Save gregdeane/28f0f26ad5aa3f8f08a9be323284579d to your computer and use it in GitHub Desktop.
Random code snippets

Snippets

Replace underscores with hyphens in file and directory names

# perform a dry run first
for i in *; do echo mv "$i" "`echo $i | sed -e 's,_,-,g'`"; done

# actually run the command
for i in *; do mv "$i" "`echo $i | sed -e 's,_,-,g'`"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment