@cokedude
When you post code which does not work, please provide sample input and sample expected output making the process specification emphatically clear.
Please also post what Operating System and version you are running and what Shell you are using.
It is unlikely than an optimum solution to your problem would involve the alias command.
Ps. I do wonder sometimes why do you persist in trying to use alias for complex commands when you should be using proper Shell Scripts?
Imho. If the alias command was deleted from all Shells it would be no great loss.
Did you know? You can modify the ${PATH} environment variable to include your scripts directory:
e.g.
PATH="${PATH}:/home/myuser/myscripts";export PATH
Then you can use the name of your script as if it was a command and avoid using aliases.