Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- FILENAME_IN="$1"
- FILENAME_OUT="output/$1"
- while IFS='' read -r line || [[ -n "$line" ]]; do
- LINE=$line
- NEWLINE=''
- if [[ $line == *"custom_viewport_width"* ]]
- then
- CUSTOM_VIEWPORT_WIDTH=$(echo "$line" | sed 's/custom_viewport_width = "\(.*\)"/\1/')
- NEWLINE='custom_viewport_width = "'$((CUSTOM_VIEWPORT_WIDTH * 2/3))'"';
- fi
- if [[ $line == *"custom_viewport_height"* ]]
- then
- CUSTOM_VIEWPORT_HEIGHT=$(echo "$line" | sed 's/custom_viewport_height = "\(.*\)"/\1/')
- NEWLINE='custom_viewport_height = "'$((CUSTOM_VIEWPORT_HEIGHT * 2/3))'"';
- fi
- if [[ $line == *"custom_viewport_x"* ]]
- then
- CUSTOM_VIEWPORT_X=$(echo "$line" | sed 's/custom_viewport_x = "\(.*\)"/\1/')
- NEWLINE='custom_viewport_x = "'$((CUSTOM_VIEWPORT_X * 2/3))'"';
- fi
- if [[ $line == *"custom_viewport_y"* ]]
- then
- CUSTOM_VIEWPORT_Y=$(echo "$line" | sed 's/custom_viewport_y = "\(.*\)"/\1/')
- NEWLINE='custom_viewport_y = "'$((CUSTOM_VIEWPORT_Y * 2/3))'"'
- fi
- if [[ $NEWLINE == "" ]]
- then
- NEWLINE=$LINE
- fi
- echo "$NEWLINE" >> $FILENAME_OUT
- done < "$1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement