how to remove all unneeded characters from a .txt file?(only keep letters and numbers)

Status
Not open for further replies.

ub3rl337z4ur

Estimable
Sep 12, 2015
1
0
4,510
I need an automatic system. There are a lot of special characters that all need to be removed from more than 1 file.
 
Hire a programmer to write an application for you. Or learn little bit about "sed" command-line utility and how to install it under Windows (warning: this is not point-and-click task!!!)
 
If you are under windows, install cygwin: https://www.cygwin.com/

Then open up the cygwin terminal and use the following command:

Code:
for f in *.txt; do sed 's/[^[:alnum:]]//g' "$f"; done

This loops through all files with a .txt extension in the current directory and deletes all non-alphanumeric characters. If you want to preserve whitespace as well:

Code:
for f in *.txt; do sed 's/[^[:alnum:][:space:]]//g' "$f"; done
 
Status
Not open for further replies.