[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
help with bash script to translate @ref{} items in translated manuals
From: |
Federico Bruni |
Subject: |
help with bash script to translate @ref{} items in translated manuals |
Date: |
Thu, 20 Apr 2017 08:20:26 +0200 |
Hi all
I recently realized that @ref{} links should be translated otherwise
PDF links are broken (while HTML files still work fine without @ref{}
translated).
Yesterday I started to manually translate all the @ref{} instances in
the italian web, usage and learning manuals.
Now I've come to the notation manual, which has too many items.
[notation (translation %)]$ grep -oh -e @ref{.*} *.itely | sort -u | wc
-l
257
[notation (translation %)]$ grep -oh -e @ref{.*} *.itely | wc -l
702
257 different @ref and a total of 702 @ref
Not all these 257 ref are translated (as translation of this manual is
not complete yet), but most are.
So I decided to try a bash script, but I have a problem with a regexp,
which works fine in the terminal but not in the bash script.
Enter Documentation/it/notation and run this:
#!/bin/bash
LIST="$(grep -oh -e @ref{.*} *.itely | sort -u)"
for i in $LIST; do
echo $i
# echo -n "Replace" $i "with the translated node: "
# read NODE
# if $NODE=""; then exit
# else
# sed "s|$i|$NODE|g" *.itely
# fi
done
You'll get something like:
@ref{Tuplets}
@ref{Turkish
classical
music}
@ref{Typesetting
Gregorian
chant}
The problem is the space character, which is not matched in the bash
script.
Why?
Thanks in advance
Federico