Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use linux's tr command for character conversion

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the use of linux tr command for character conversion, has a certain reference value, friends in need can refer to. Let's take a look at it with me.

The English full name of tr is "transform", which means transformation. The purpose of this command is to replace, compress, and delete characters, and it can convert one set of characters into another. Tr he can only read data from standard input, so tr either redirects the input file to standard input or reads the data from the pipeline.

Note: tr is similar to the sed command, but simpler than sed, so sed can implement everything tr can do.

Syntax format: tr [parameters] [string 1] [string 2]

Common parameters:

-c the complement of the character set in the selected string 1, that is, the complement of the inverted string 1-d deletes all characters that appear in the string 1-s deletes all repeated character sequences, leaving only one

Reference exampl

To realize the call of big and small letters:

[root@linuxcool ~] # cat file_1

Abc 012

Def 345

Ghi 678

Jkl 909

[root@linuxcool ~] # tr "[Amurz]"[Amurz]"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report