Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- file="$1"
- file1='/tmp/tmp_quotations_extract1'
- # Только цитаты
- file2='/tmp/tmp_quotations_extract2'
- seps='\$\$'
- command=`basename "$0"`
- useparam ()
- {
- if [ "$1" = '--help' ] || [ "$1" = "" ]; then
- echo -e "[$command]: Использование параметров:\n1: Файл для чтения" && exit
- fi
- }
- exist ()
- {
- if [ ! -e "$1" ]; then
- echo "[$command]: Объект [$1] не найден."
- exit
- fi
- }
- remove_tmp ()
- {
- rm "$file1" "$file2"
- }
- useparam "$file"
- exist "$file"
- exist "$file2"
- echo "[$command]: Объединение цитат с переводом..."
- let i=0
- while read line; do
- array[$i]="$line"
- let i=$i+1
- done < "$file2"
- maxi=${#array[@]}
- #echo "Debug: maxi: [$maxi]"
- par=""
- let i=0
- while [ "$i" -lt "$maxi" ]; do
- line="${array[$i]}"
- #sed -i "s/$seps/\[\[$line\]\]/" "$file"
- echo "[$i]: Заменяю [$seps] на [$line]..."
- #echo "Debug: i: [$i]"
- #echo "Debug: a[i]: [$line]"
- let i=$i+1
- #mo "$file"
- done
- #remove_tmp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement