Bash Loop Through String Python Replace Substring