aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarianne Chevrot <blackmoor@devys.org>2018-08-12 21:41:39 +0200
committerCédric Picard <cpicard@purrfect.fr>2018-08-18 09:08:03 +0200
commite19fe8b4f41506e334c61f371be40b1f7ea65995 (patch)
tree139846f8157cf6f55f0328d14b1f8ed592cb66e3
parentb217b23ada2597292934a1f22001719c014b0ebb (diff)
downloadbulkrename-e19fe8b4f41506e334c61f371be40b1f7ea65995.tar.gz
bulkrename-e19fe8b4f41506e334c61f371be40b1f7ea65995.tar.bz2
bulkrename-e19fe8b4f41506e334c61f371be40b1f7ea65995.zip
Fix renaming to an already existing name
-rwxr-xr-xbulkrename6
1 files changed, 3 insertions, 3 deletions
diff --git a/bulkrename b/bulkrename
index a1f196e..a488381 100755
--- a/bulkrename
+++ b/bulkrename
@@ -28,9 +28,9 @@ fi
sed -i -- 's/\([\\"$`]\)/\\\1/g;' "${namebase}.1" "${namebase}.2"
(echo '# Please review/modify this script or empty it to do nothing' \
- ; paste -d "\n" -- "${namebase}.1" "${namebase}.2" \
- | uniq -c \
- | sed -n 's/^ *1 \(.*\)$/"\1"/p' \
+ ; comm -3 --output-delimiter="" "${namebase}.1" "${namebase}.2" \
+ | tr -d '\0' \
+ | sed 's/^.*$/"&"/' \
| xargs -d"\n" -L2 echo 'mv -i --') \
> "${namebase}.sh"