cat yourfile.txt | tr -dc '[:alnum:]\n\r' cat yourfile.txt | sed 's/[^a-zA-Z0-9]//g' cat yourfile.txt | tr -dc '[:print:]'