- Learning Linux Shell Scripting
- Ganesh Naik
- 87字
- 2021-06-25 22:02:50
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.
推薦閱讀
- 后稀缺:自動化與未來工作
- JMAG電機電磁仿真分析與實例解析
- 數據挖掘方法及天體光譜挖掘技術
- Supervised Machine Learning with Python
- 21天學通Visual C++
- CentOS 8 Essentials
- 可編程序控制器應用實訓(三菱機型)
- 我也能做CTO之程序員職業規劃
- 中國戰略性新興產業研究與發展·智能制造裝備
- DevOps Bootcamp
- Spatial Analytics with ArcGIS
- 人工智能:語言智能處理
- 基于ARM9的小型機器人制作
- Dreamweaver+Photoshop+Flash+Fireworks網站建設與網頁設計完全實用
- 手把手教你學Photoshop CS3