TR Command-linux command five-minute series six

Source: Internet
Author: User
Tags printable characters

This original article belongs to the "Linux Greenhouse" blog.

The blog address is

Article author for Roc

I hope you can donate to support the operation and development of the Linux greenhouse blog. See "About Donations"


The TR instruction reads the data from the standard input device and, after the string translation, outputs to the standard output device.

Cat filename |tr u n : Used to replace the U in the filename file with N on the screen , but the actual file is not replaced

Cat FileName | TR- d ABC deletes all occurrences of A or B or C characters from the filename content on the screen and displays

Cat filename|tr [: Lower:] [: Upper:] capitalizes all lowercase in the contents of the file

A substitution symbol similar to [: Lower:] is also:

[: Alnum:] denotes all letters and numbers

[: Alpha:] denotes all the letters

[: blank:] denotes all spaces

[:d igit:] denotes all numbers

[: Graph:] denotes all printable characters but does not include spaces

[:p rint:] denotes all printable characters, including spaces

For an overview view, refer to the use of the TR command in detail

TR Command-linux command five-minute series six

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.