From 8d6876042be97cc1578088f65e9fa269e6173ec9 Mon Sep 17 00:00:00 2001 From: Alexandre Dupas Date: Sun, 31 Oct 2010 23:42:17 +0100 Subject: [PATCH] Correction and simplification of the typo correction script. --- utils/typo.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/utils/typo.sh b/utils/typo.sh index e7ae3c63..2139abe3 100755 --- a/utils/typo.sh +++ b/utils/typo.sh @@ -8,17 +8,18 @@ for song in songs/*/*.sg; do if grep -q "selectlanguage{english}" $song then - sed -i "s/ ?/?/g" $song; - sed -i "s/ !/!/g" $song; - sed -i "s/ :/:/g" $song; + sed -i \ + -e 's/(\s)*?/?/g' \ + -e 's/(\s)*!/!/g' \ + -e 's/(\s)*:/:/g' \ + $song; fi; if grep -q "selectlanguage{french}" $song then - sed -i "s/?/ ?/g" $song; - sed -i "s/ ?/ ?/g" $song; - sed -i "s/!/ !/g" $song; - sed -i "s/ !/ !/g" $song; - sed -i "s/:/ :/g" $song; - sed -i "s/ :/ :/g" $song; + sed -i \ + -e 's/\([^ ]\)?/\1 ?/g' \ + -e 's/\([^ ]\)!/\1 !/g' \ + -e '/\\gtab.*/ ! s/\([^ ]\):/\1 :/g' \ + $song; fi; done;