mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-06-14 18:31:41 +00:00
Moved hub into the git plugin.
This commit is contained in:
12
plugins/perl/functions/pgs
Normal file
12
plugins/perl/functions/pgs
Normal file
@ -0,0 +1,12 @@
|
||||
# Perl Global Substitution
|
||||
if (( $# < 2 )); then
|
||||
print "Usage: $0 find replace [file ...]" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local find="$1"
|
||||
local replace="$2"
|
||||
repeat 2 shift
|
||||
|
||||
perl -i.orig -pe 's/'"$find"'/'"$replace"'/g' "$@"
|
||||
|
11
plugins/perl/functions/prep
Normal file
11
plugins/perl/functions/prep
Normal file
@ -0,0 +1,11 @@
|
||||
# Perl grep since 'grep -P' is terrible.
|
||||
if (( $# < 1 )) ; then
|
||||
print "Usage: $0 pattern [file ...]" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local pattern="$1"
|
||||
shift
|
||||
|
||||
perl -nle 'print if /'"$pattern"'/;' "$@"
|
||||
|
Reference in New Issue
Block a user