#!/bin/bash# Split ${FILENAME} every 4,000 bytes
split-b4000$1tmp
# define output filenameORIGINAL_FILE_NAME=$(echo$1|awk-F'.''{print $1}')ORIGINAL_EXTENSION=$(echo$1|awk-F'.''{print $2}')OUTPUT=${ORIGINAL_FILE_NAME}_ja.${ORIGINAL_EXTENSION}# Read the divided files in orderforfilepathintmp*;doTEXT=$(cat$filepath)# Execute 'aws translate' subcommand with property read from split file contentawstranslatetranslate-text--text"${TEXT}"\--source-language-codeen\--target-language-codeja\|jq-r'.TranslatedText'>>${OUTPUT}done# Post process 1 : Normalize link representation in Markdown
sed-i.bak's/\[ /\[/g'${OUTPUT}# Post process 2 : Normalize link representation in Markdown
sed-i.bak's/\] /\]/g'${OUTPUT}# Post process 3,4 : Normalize bulleted with Markdown
sed-i.bak's/-/- /g'${OUTPUT}
sed-i.bak's/\* /\*/g'${OUTPUT}# Post process 5 : Normalize an ordered list with Markdown
sed-i.bak's/\([0-9]\)。/\1. /g'${OUTPUT}# Post process 6,7 : Delete temporary files
rm-rf*.bak
rm-rftmp*