When copy/paste has invisible characters, how do I get rid of them?
When I copy and paste text between applications sometimes bogus invisible characters get introduced that really screw things up.
Simply re-typing the characters fixes the problem.
What’s happening
When I copy unix commands from my notes in MS Word to invisible characters are actually present that I can’t see and these cause problems.
For example, My notes might have this command:
ls -l /tmp
But when I copy/paste it to the UNIX command line I get:
ls -l /tmp
/bin/ls: cannot access '/tmp ': No such file or directory
The solution
This UNIX command seemed to fix the problem for me tr -cd ‘\11\12\15\40-\176’ < input-file > clean-file