Last active
February 16, 2018 00:48
-
-
Save Naheel-Azawy/607740aac3cbb0f68cb9a48c6203b0e4 to your computer and use it in GitHub Desktop.
Renames the app-id of a project built with GNOME Builder. Usage `rename-gnome-builder-project-app-id.sh "org.something.blabla"`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
OLD=$(grep -rh '"app-id":' *.json | sed 's/[",]//g' | awk '{print $2}') | |
NEW=$1 | |
OLD2="${OLD//./\\.}" | |
OLD3="${OLD//.//}" | |
OLD4="${OLD//./\\/}" | |
NEW4="${NEW//./\\/}" | |
for s in $(find -name "*$OLD*"); do mv $s "${s/$OLD/$NEW}"; done | |
for s in $(grep -rIl $OLD2); do sed -i "s/$OLD2/$NEW/g" $s; done | |
for s in $(grep -rIl $OLD3); do sed -i "s/$OLD4/$NEW4/g" $s; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment