dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 0f38312d1df0de7fa9c8394bfd1161f30534abd2
parent 27915a21f53015f590672dfdb095002df3009b2a
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 15 Apr 2020 10:21:59 +0200

Add script to rename files with octal encoding for danish characters

Diffstat:
A.local/bin/fnfix | 26++++++++++++++++++++++++++
1 file changed, 26 insertions(+), 0 deletions(-)

diff --git a/.local/bin/fnfix b/.local/bin/fnfix @@ -0,0 +1,26 @@ +#!/bin/sh +# rename all files passed as arguments containing danish characters. + +replacerules() { + sed 's/æ/ae/g + s/ø/oe/g + s/Ã¥/aa/g + s/Æ/AE/g + s/Ø/OE/g + s/Ã…/AA/g + s/æ/ae/g + s/ë/ae/g + s/ø/oe/g + s/õ/oe/g + s/Ø/OE/g + s/ù/OE/g + s/Å/AA/g + s/ü/ue/g' +} + +for f in "$@"; do + r="$(printf '%s' "$f" | replacerules)" + if [ ! "$f" = "$r" ]; then + mv -i "$f" "$r" + fi +done