diff scripts/removeWithSignature @ 112:3951f6d27219

Add various useful scripts. Refactor out SQL-statements.
author Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no>
date Tue, 03 May 2016 02:20:07 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/removeWithSignature	Tue May 03 02:20:07 2016 +0200
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+FORCE=false
+while getopts 'f' val
+do
+  case $val in
+    f) FORCE=true ;;
+    ?) exit 1;
+  esac
+done
+let nopts=OPTIND-1
+shift ${nopts}
+
+if $FORCE
+then
+ command=rm
+else
+  command=echo
+fi
+
+TARGET=$1
+shift
+
+while [ -n "$1" ]
+do
+	~/projects/dedupe/scripts/duplicates.sh -s $TARGET | grep $1 | cut -d\| -f3- | xargs -d '\n' -n 1 $command
+	shift
+done