1 Star 0 Fork 0

CNCF/devstatscode

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
find_and_replace.sh 785 Bytes
一键复制 编辑 原始数据 按行查看 历史
Lukasz Gryglicki 提交于 2019-03-21 16:44 +08:00 . New util scripts [wip]
#!/bin/bash
if [ -z "$FROM" ]
then
export FROM="`cat ./FROM`"
fi
if [ -z "$TO" ]
then
export TO="`cat ./TO`"
fi
if [ -z "$MODE" ]
then
export MODE=ss0
fi
if [ -z "$FILES" ]
then
if [ -z "$1" ]
then
echo "You need to provide path as first arument"
exit 1
fi
if [ -z "$2" ]
then
echo "You need to provide file name pattern as a second argument"
exit 2
fi
if [ -z "$3" ]
then
echo "You need to provide regexp pattern to search for as a third argument"
exit 3
fi
find "$1" -type f -iname "$2" -not -name "out" -not -path '*.git/*' -exec grep -El "$3" "{}" \; > out
export FILES=`cat out`
fi
if [ -z "$DRY" ]
then
./devel/mass_replace.sh
else
echo "from: '$FROM'"
echo "to: '$TO'"
echo "mode: '$MODE'"
echo "files: '$FILES'"
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cncf/devstatscode.git
git@gitee.com:cncf/devstatscode.git
cncf
devstatscode
devstatscode
master

搜索帮助