16 lines
442 B
Bash
Executable file
16 lines
442 B
Bash
Executable file
#!/bin/bash
|
|
|
|
format() {
|
|
sed -e 's/^fix:/доза:/' \
|
|
-e '/^# ------------------------ >8 ------------------------$/,$d' \
|
|
-e '/^#/d'
|
|
}
|
|
|
|
translated="$(curl -s \
|
|
http://localhost:9000/translate \
|
|
-H 'Content-Type: text/html' \
|
|
--data-binary @- -o- < <(format < "$1") | \
|
|
tail -n +2 | \
|
|
perl -pe 's,<SPAN CLASS=UNKNOWN_WORD>(.*?)</SPAN>,\1,g')"
|
|
|
|
[ -n "$translated" ] && echo "$translated" > "$1"
|