Replaces all occurences of .bind(bind, args) with .pass(args, bind) in the target files or directories.
This file contains hidden or 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 usage(){ echo 'Replaces all occurences of .bind(bind, args) with' echo '.pass(args, bind) in the target files or directories.' echo echo "Usage: $0 [options] [paths...]" echo echo 'options:' echo ' -h' echo ' --help Show this help.' echo ' -n' echo " --dry-run Don't do anything, only show the files and lines" echo ' that would be affected.' echo echo 'arguments:' echo ' [paths] Files and/or directories to search and replace.' echo ' Defaults to the current working directory.' } while true; do case "$1" in -h|--help) usage; exit;; -n|--dry-run) DRYRUN=1; shift;; -*) echo "Unknown option '$1', ignoring." >&2; shift;; --) shift; break;; *) break;; esac done ARGS=$@ if [ -z "$ARGS" ]; then ARGS='./' fi FILES=`grep -lr 'bind([^,)]\+,' $ARGS` if [ -z "$FILES" ]; then echo 'No occurences of .bind(bind, args) found.' exit 1 fi if [ -n "$DRYRUN" ]; then for F in $FILES; do echo "$F:" grep -nr 'bind([^,)]\+,' "$F" done exit fi echo "Replacing in files:" for F in $FILES; do echo "- $F" sed -i'.orig' 's/\.bind(\([^,]*\), *\([^)]*\))/\.pass(\2, \1)/g' "$F" doneRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4