commit 15b0f65cc119cc5bfc31c2378037b42dffe8173a Author: kuiki Date: Wed Feb 20 16:14:13 2019 +0800 完成基本脚本 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d383c56 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +testdata diff --git a/find.sh b/find.sh new file mode 100755 index 0000000..80cf81d --- /dev/null +++ b/find.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +results=$(find . -name '*_1.txt') +for result in $results;do + originFile=$(echo $result | sed 's/\(.*\)_1\(\..*\)/\1\2/g') + if [ -f $originFile ];then + echo "$originFile exist!" + same=$(diff $result $originFile) + if [ ! -n "$same" ];then + echo 'file same' + rm $result + fi + fi +done