JavaScript
x
str="#$hello,)&^this I!s> m@ani: /& "
I need the perfect alphabetical string without special characters. can you suggest me how to do in shell
Advertisement
Answer
The following solution uses the tr
command:
JavaScript
$ str=`echo '"#$hello,)&^this I!s> m@ani: /& "'`
$ echo $str | tr -cd "[:alnum:]"n"
"hellothisIsmani"
All letters and digits, all ” and new lines are allowed. If you want more or less characters to be allowed change the command.