0% found this document useful (0 votes)
73 views3 pages

Using the tr Command in Shell Scripts

The tr command is used to translate or delete characters in a shell script. It takes input from a file or command and replaces or removes characters based on the provided sets. The tr command syntax includes options like -d to delete characters and SET1 and SET2 to define the characters to translate or remove. It can perform tasks like converting uppercase to lowercase, deleting spaces, or replacing digits with other characters.

Uploaded by

Gaurav Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views3 pages

Using the tr Command in Shell Scripts

The tr command is used to translate or delete characters in a shell script. It takes input from a file or command and replaces or removes characters based on the provided sets. The tr command syntax includes options like -d to delete characters and SET1 and SET2 to define the characters to translate or remove. It can perform tasks like converting uppercase to lowercase, deleting spaces, or replacing digits with other characters.

Uploaded by

Gaurav Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

tr command for shell scripting

NarendraP

Learn How to Automate Common Tasks with Bash Shell Scripting


tr command
 tr: short for translate
 tr is useful to translate or delete given set of characters from the input.
 Syntax:
 tr [options] [SET1] [SET2] <inputFile
 Some Command | tr [options] [SET1] [SET2]

 No Option: For translation


 Examples for SET1/SET2: [:lower:], [a-z], [:upper:] [A-Z] , [:digit:] , [0-9], [:space:]
 -d : deletes given set of characters.

Learn How to Automate Common Tasks with Bash Shell Scripting


Thank you

You might also like