上QQ阅读APP看书,第一时间看更新
Deleting characters using tr
The tr command has an option -d to delete a set of characters that appear on stdin using the specified set of characters to be deleted, as follows:
$ cat file.txt | tr -d '[set1]' #Only set1 is used, not set2
Consider this example:
$ echo "Hello 123 world 456" | tr -d '0-9' Hello world # Removes the numbers from stdin and print