I am trying to remove all non-alphanumeric from a text file with the following command:
cat textfile.txt | tr -cd [:alnum:] > textfile_alnum.txt
This works, except that now the output within textfile_alnum.txt
is all on the same line. How can I maintain each string on a separate line?