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

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.

主站蜘蛛池模板: 平潭县| 房产| 临沧市| 富平县| 安吉县| 衡水市| 中西区| 贵港市| 绥中县| 聂拉木县| 宝兴县| 西乌珠穆沁旗| 三明市| 乐安县| 台中县| 调兵山市| 公安县| 乡城县| 永年县| 泰州市| 咸丰县| 抚州市| 当阳市| 赤壁市| 南澳县| 罗甸县| 黔西县| 宕昌县| 元阳县| 巍山| 芜湖市| 德安县| 修武县| 绥芬河市| 洪江市| 咸宁市| 如东县| 吉林省| 崇礼县| 双柏县| 宁津县|