I have file with a lot of text, what I want to do is to remove all alphanumeric words.
Example of words to be removed:
gr8
2006
sdlfj435ljsa
232asa
asld213
ladj2343asda
asd!32
what is the best way I can do this?
If you want to remove all words that consist of letters and digits, leaving only words that consist of all digits or all letters:
sed 's/\([[:alpha:]]\+[[:digit:]]\+[[:alnum:]]*\|[[:digit:]]\+[[:alpha:]]\+[[:alnum:]]*\) \?//g' inputfile
Example:
$ echo 'abc def ghi 111 222 ab3 a34 43a a34a 4ab3' | sed 's/\<\([[:alpha:]]\+[[:digit:]]\+[[:alnum:]]*\|[[:digit:]]\+[[:alpha:]]\+[[:alnum:]]*\) \?//g'
abc def ghi 111 222