LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Remove numbers, spaces, line breaks & paragraphs from .txt on CLI (https://www.linuxquestions.org/questions/linux-newbie-8/remove-numbers-spaces-line-breaks-and-paragraphs-from-txt-on-cli-4175611934/)

rokyo 08-14-2017 08:38 AM

Remove numbers, spaces, line breaks & paragraphs from .txt on CLI
 
Hi everybody!

I am looking for a way to strip all non-letter characters (i.e. spaces, numbers, line breaks and paragraph breaks) from a .txt file using the terminal, so that afterwards the .txt file will be just a loooooooong single line of letters. I want to keep upper and lower case, though.

Thank you in advance for any help!

rokyo

syg00 08-14-2017 08:59 AM

"man tr"
Can be achieved with a single invocation.

Turbocapitalist 08-14-2017 08:59 AM

I would look at tr or sed for that. It is easy in either. Try tr first as it is simpler.

rokyo 08-14-2017 09:20 AM

Thanks, tr worked perfectly with:

Code:

tr -cd [:alpha:] < test.txt > test_processes.txt
Took maybe 2 seconds on CLI, while doing this in LibreOffice made my computer run out of RAM and crash. :D


All times are GMT -5. The time now is 04:26 AM.