Skip to content

Instantly share code, notes, and snippets.

@gustin
Forked from nerdyworm/rename.sh
Created April 10, 2019 01:08
Show Gist options
  • Select an option

  • Save gustin/11bb4554bcf40b32f28bbb7657febb80 to your computer and use it in GitHub Desktop.

Select an option

Save gustin/11bb4554bcf40b32f28bbb7657febb80 to your computer and use it in GitHub Desktop.

Revisions

  1. @nerdyworm nerdyworm created this gist Jul 30, 2016.
    15 changes: 15 additions & 0 deletions rename.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/bin/bash

    set -e

    CURRENT_NAME="CurentName"
    CURRENT_OTP="current_name"

    NEW_NAME="NewName"
    NEW_OTP="new_name"

    ack -l $CURRENT_NAME | xargs sed -i '' -e "s/$CURRENT_NAME/$NEW_NAME/g"
    ack -l $CURRENT_OTP | xargs sed -i '' -e "s/$CURRENT_OTP/$NEW_OTP/g"

    mv lib/$CURRENT_OTP lib/$NEW_OTP
    mv lib/$CURRENT_OTP.ex lib/$NEW_OTP.ex