Bash: tr: A couple of usefull applications


(How) to delete all instances of a character from a file:
The following example deletes all instances of the character ‘v’

cat someFile | tr -d v

(How) to replace all instances of a character with another:
The following example replaces all space characters with the new line character

cat someFile | tr ' ' '\n'

This post is also available in: Greek

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.