#!/bin/bash
if [ -z "$BASH_VERSION" ]; then exec bash "$0" "$@"; exit; fi

before_version=$1
after_version=$2
grep_path=$3

if [[ $before_version == '' || $after_version == '' ]]; then
		echo '[Usage] $0 {before_version} {after_version}'
		exit
fi

grep -rn ${before_version} ${grep_path} | awk -F':' {'print $1'} | uniq | /usr/bin/xargs sed -i "s/${before_version}/${after_version}/g"

echo "success"