Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- file="/tmp/info"
- tmpfile="/tmp/tmp_tst"
- replace ()
- {
- replace_what="$1"
- replace_with="$2"
- sed -i "s/$replace_what/$replace_with/g" "$tmpfile"
- }
- replace_all ()
- {
- replace "плотину" "the dam"
- replace "фотографий" "photos"
- replace "оказалось" "it has appeared that"
- replace "наводнение" "the flood"
- replace "В итоге" "As a result,"
- }
- test_cycle ()
- {
- echo "Прогон цикла замены..."
- let i=0
- while [ $i -le "500" ]; do
- replace_all
- ((i++))
- done
- echo "Завершено."
- }
- cat "$file" > "$tmpfile"
- time test_cycle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement