#!/bin/bash

grep_search=${1}
#file_location=~/Coding/WIP
file_location=~/Coding/simutrans-pak128.britain/trains

echo "Replacing image data for all versions of $1"

find $file_location -type f -name "$grep_search*" -execdir sed -i -E -e '/\[E\]\[/{s/....$/\_E\.0\.0/}' -e '/\[SE\]\[/s|....$|\_SE\.0\.0|' -e '/\[S\]\[/s|....$|\_S\.0\.0|' -e '/\[SW\]\[/s|....$|\_SW\.0\.0|' -e '/\[W\]\[/s|....$|\_W\.0\.0|' -e '/\[NW\]\[/s|....$|\_NW\.0\.0|' -e '/\[N\]\[/s|....$|\_N\.0\.0|' -e '/\[NE\]\[/s|....$|\_NE\.0\.0|' {} +
