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