Bash String Functions Substring Mysql