Skip to content

Instantly share code, notes, and snippets.

Hunting giant octopuses

Kaio Magalhães kaiomagalhaes

Hunting giant octopuses
View GitHub Profile
evansd / gist:1639992
Created Jan 19, 2012
Global find and replace using ack
View gist:1639992
function substitute {
if [ -z "$1" -o -z "$2" ]; then
echo "Usage: substitue FROM_STRING TO_STRING [OPTION]..."
echo "Replace all occurances of FROM_STRING (a sed-compatible regular"
echo "expression) with TO_STRING in all files for which ack-grep matches"
echo "Any additional options are passed directly to ack-grep (e.g.,"
echo " --type=html would only run the substitution on html files)."