We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Linux Shell
  3. Text Processing
  4. 'Tr' Command #1
  5. Tutorial

'Tr' Command #1

Problem
Submissions
Leaderboard
Discussions
Tutorial

Here's a useful video on the topic:

For example:
'e' being transformed to 'E'

$ echo "Hello" | tr "e" "E"
HEllo

Spaces being transformed to hyphens

$ echo "Hello how are you" | tr " " '-'
Hello-how-are-you

Digits (numerals) being deleted

$ echo "Hello how are you 1234" | tr -d [0-9]
Hello how are you 

This tutorial shows various ways that the tr command may be used for transforming or translating characters or character classes. It can also be used to delete, complement, remove or squeeze characters.

View Practice Challenge

tutorial details


Need Help?


View discussions
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy