Post date: 2-set-2014 18.52.12
richiede trans shell
gawk >=4.0
https://raw.githubusercontent.com/soimort/translate-shell/gh-pages/trans
http://www.soimort.org/translate-shell/
--------------------------inizio script---------------------------------------
#!/bin/bash
filename=$1
#converto il file per linux
tr -d '\015' <$filename > $filename.tmp
righe=$(wc -l $filename.tmp | awk '{print $1}')
echo numero righe $righe
riga=0
while [ $riga -lt $righe ]; do
let "riga ++";
current=$(head -$riga $filename.tmp | tail -1)
if [[ ${current:0:1} =~ $(echo "[0-9]") ]]; then
echo $current >>$filename-it.srt
else
echo $current |trans -b en:it >>$filename-it.srt
fi
let "step = $righe - $riga";
echo mancano ancora $step;
done
echo traduzione completata
rm $filename.tmp
------------------------------------fine script-------------------------------------------------
in shell digitare
SRT.sh nomefile.srt