What are the contents of the UNIX script you are currently using?
Can you give us a small sample input file containing some of the characters you want to delete and a corresponding sample output file showing the corresponding output you hope to produce?
Please keep in mind that "web-centric" programming languages like PHP and others have a rich set of commands built to transform and process HTML files; and most web developers, including me, use these tools to make the transformation(s) you are considering.
PHP runs "just fine" from the "UNIX" or "Linux" command line in most modern operating systems.
But, as Don mentioned, without knowing the details of your OS, we are just shooting in the dark.