Thamizhiniyan C S
HomeWriteupsResourcesCheatsheets
HackerRank
HackerRank
  • HackerRank
  • Linux Shell
    • Bash
    • Text Processing
      • Cut
      • Head
      • Middle
      • Tail
      • Tr
      • Sort
      • Uniq
      • Paste
    • Arrays In Bash
    • Grep Sed Awk
      • Grep
      • Sed
      • Awk
  • Regex
    • Introduction
    • Character Class
    • Repetitions
    • Grouping and Capturing
    • Backreferences
    • Assertions
    • Applications
  • Python
    • Introduction
    • Basic Data Types
    • Strings
    • Sets
    • Math
    • Itertools
    • Collections
    • Date and Time
    • Errors and Exceptions
    • Classes
    • Built-Ins
    • Python Functionals
    • Regex and Parsing
    • XML
    • Closures and Decorators
    • Numpy
    • Debugging
  • C
    • Introduction
    • Conditionals and Loops
    • Arrays and Strings
Powered by GitBook
On this page
  • 'Tr' Command #1
  • 'Tr' Command #2
  • 'Tr' Command #3

Was this helpful?

  1. Linux Shell
  2. Text Processing

Tr

'Tr' Command #1

In this challenge, we practice using the tr command because it is a useful translation tool in Linux.

In a given fragment of text, replace all parentheses ( ) with box brackets [ ].

tr '(' '[' | tr ')' ']'
# ---------or---------- 
tr '()' '[]'

'Tr' Command #2

In this challenge, we practice using the tr command because it is a useful translation tool in Linux.

In a given fragment of text, delete all the lowercase characters a-z.

tr -d a-z

'Tr' Command #3

In a given fragment of text, replace all sequences of multiple spaces with just one space.

tr -s ' '
PreviousTailNextSort

Last updated 1 year ago

Was this helpful?