From 82d07da3add2393c53d20e41e8aba383f058858f Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sat, 1 Jun 2024 13:32:36 +0200 Subject: checkpoint --- bin/menuscripts/muzrname | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/menuscripts/muzrname (limited to 'bin/menuscripts/muzrname') diff --git a/bin/menuscripts/muzrname b/bin/menuscripts/muzrname new file mode 100755 index 0000000..3f63aff --- /dev/null +++ b/bin/menuscripts/muzrname @@ -0,0 +1,22 @@ +#!/bin/sh + +rename() +{ + ## Expression 1: + # For CDs or volumes 1-01 -> 1_01 + ## Expression 2: + # * don't match the start (^) + # match the first part with a number and replace following [ -.] by '. ' + sed -e 's/^\s*\([0-9]\+\)[ -_.]\([0-9]\+\)/\1_\2. /' \ + -e 's#\s*\([0-9]\+\)[ -.]\+#\1. #' +} + +if [ ! -t 0 ] +then + rename +elif [ "$1" ] +then + printf '%s' "$1" | rename +else + exit 1 +fi -- cgit v1.2.3