The tr command can be used to delete specific characters from a string by using the -d option followed by the characters you want to remove. Here’s the syntax:
tr -d 'characters_to_delete' < input_file
If you want to delete characters directly from a string, you can use echo in combination with tr. For example, to delete digits and punctuation (like colons, commas, and semicolons) from a string, you can use:
echo 'Hello, World! 1234: Test;' | tr -d '0-9:,;'
This command will output:
Hello World! Test
In this example, all digits and the specified punctuation characters are removed from the input string.
