From 15b0f65cc119cc5bfc31c2378037b42dffe8173a Mon Sep 17 00:00:00 2001 From: kuiki Date: Wed, 20 Feb 2019 16:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=9F=BA=E6=9C=AC=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + find.sh | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .gitignore create mode 100755 find.sh 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