view 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 source

#!/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