官术网_书友最值得收藏!

The tr command

The tr command is a Linux utility for text processing, such as translating, deleting, or squeezing repeated characters, which is shown as follows:

    $ tr '[a-z]' '[A-Z]' < filename

This will translate the lowercase characters to uppercase:

    $ tr '|' '~' < emp.lst

This will squeeze multiple spaces into a single space:

    $ ls -l | tr -s " "

In this example, the -s option squeezes multiple contiguous occurrences of the character into a single char. Additionally, the -d option can remove characters.

主站蜘蛛池模板: 阿城市| 富川| 清河县| 浦东新区| 克山县| 泸水县| 东明县| 和静县| 奉贤区| 兴义市| 克东县| 大英县| 青海省| 蓬莱市| 芷江| 丹江口市| 武功县| 泰和县| 茶陵县| 天气| 上高县| 宣汉县| 达日县| 清水河县| 洞口县| 墨脱县| 石棉县| 察雅县| 盐亭县| 万盛区| 申扎县| 达孜县| 内江市| 同仁县| 平昌县| 望城县| 孝昌县| 宁安市| 嘉善县| 五原县| 仲巴县|