Skip to content

Instantly share code, notes, and snippets.

@shebin512
Last active November 3, 2017 12:26
Show Gist options
  • Save shebin512/d6c10a8b568ea9598530 to your computer and use it in GitHub Desktop.
Save shebin512/d6c10a8b568ea9598530 to your computer and use it in GitHub Desktop.
My Snippets

My Snippets

 svn st |grep "^M"|awk '{print $2}'|while read line; do svn diff $line;done
 svn st |grep "^M"|awk '{print $2}'|while read line; do echo $line;done
 svn st |grep "^M"|awk '{print $2}'|while read line; do echo -n $line, ;done //without trailing new line and comma seperated
 svn st |grep "^M"|awk '{print $2}'|while read line; do echo -n $line" " ;done //without trailing new line and single space (" ") seperated
 svn ci `svn st |grep "^M"|awk '{print $2}'|while read line; do echo -n $line" ";done` //svn commit all the modified files

Find Script to find file names in dir from list of file

cat /tmp/image_list_sku.txt|while read line ;do find /tmp/evok_imgs/ -iname "*$line*";done //file search
cat /tmp/image_list_sku.txt|while read line ;do find /tmp/evok_imgs/ -iname "*$line*"|wc -l;done // file search count

Remove backupfiles (PUMA)

Identify the backup files naming pattern. Then replace the iname pattern with appropriate one

find ./app/ -iname "*.php_*" -type f -print # print list of backup files.
find ./app/ -iname "*.php_*" -type f -exec rm -v {} \; # remove the backup files.

find ./app/ -iname "*.xml_*" -type f -print
find ./app/ -iname "*.xml_*" -type f -exec rm -v {} \; 

find ./app/ -iname "*.phtml_*" -type f -print
find ./app/ -iname "*.phtml_*" -type f -exec rm -v {} \;

find ./app/ -iname "*.php.bak*" -type f -print
find ./app/ -iname "*.php.bak*" -type f -exec rm -v {} \;

find ./app/ -iname "*.xml.bak*" -type f -print
find ./app/ -iname "*.xml.bak*" -type f -exec rm -v {} \;

find ./app/ -iname "*.phtml.bak*" -type f -print
find ./app/ -iname "*.phtml.bak*" -type f -exec rm -v {} \;

find ./ -iname "*.js_*" -type f -print
find ./ -iname "*.js_*" -type f -exec rm -v {} \;

Find invalid Admin URL 6788 PATCH

grep -ir  -e".*Url(.*/adminhtml\_.*" ./app/design/adminhtml/default/default/template/

##git commit file with specific status

git status | grep "deleted:"|awk '{print $2}'|while read line;do git rm $line;done

Remove Backup files using regex.

for i in `find ./ |grep -E "(_|\.)(bkp|bak)\."`; do rm -v $i ;done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment