tr用法
参考:
http://man.linuxde.net/tr
shell脚本学习指南
语法
tr [options] source-char-list replace-char-list
用途
转换字符。例如,将大写字符转换成小写。选项可让你指定要删除的字符,以及将一串重复出现的字符浓缩成一个。
Translate, squeeze, and/or delete characters from standard input, writing to standard output.
常用选项
-c或--complement:取代所有不属于第一字符集的字符;use the complement of source-char-list
-d或--delete:删除所有属于第一字符集的字符;delete characters in source-char-list, do not translate
-s或--squeeze-repeats:把连续重复的字符以单独一个字符表示;replace each input sequence of a repeated character that is listed in source-char-list with a single occurrence of that character.
-t或--truncate-set1:先删除第一字符集较第二字符集多出的字符。
支持的字符集
[:alnum:] all letters and digits
[:alpha:] all letters
[:blank:] all horizontal whitespace
[:cntrl:] all control characters
[:digit:] all digits
[:graph:] all printable characters, not including space
[:lower:] all lower case letters
[:print:] all printable characters, including space
[:punct:] all punctuation characters
[:space:] all horizontal or vertical whitespace
[:upper:] all upper case letters
[:xdigit:] all hexadecimal digits
[=CHAR=] all characters which are equivalent to CHAR
举例
将小写字符转换为大写字母
tr [:lower:] [:upper:]
tr用法的更多相关文章
- linux学习:sed与awk与tr用法整理
流编辑器:sed 语法:sed [-hnV][-e<script>][-f<script文件>][文本文件] 参数: -e<script>或--expression ...
- linux中tr用法
tr命令不能直接从文件中读取并转换文本,因此通常都使用重定向输入或者管道传递方法: -s 代替掉重复的字符 #echo "HHHHHHEEEElllooooo" | tr -s ' ...
- Linux下使用xargs将多行文本转换成一行并用tr实现逗号隔开
准备: cat test.txt 示例: cat test.txt | xargs 可以看出得到的字符串为空格隔开的. 再把上面的字符串用逗号隔开,可以使用tr命令进行空格的替换 cat test.t ...
- linux 常用命令--------雪松整理
linux 常用命令--------雪松整理 博客: http://hi.baidu.com/quanzhou722/blog错误在所难免,还望指正!========================= ...
- Linux 系统运维常用命令
1 文件管理2 软件管理3 系统管理4 服务管理5 网络管理6 磁盘管理7 用户管理8 脚本相关9 服务配置==================================------------ ...
- (八)Struts标签基础(一)
一.Struts标签分类 二.标签的使用 2.1 标签的主题 主题的设置与struts.xml中的常量<constant name="struts.ui.theme" val ...
- Linux与Unix shell编程指南(完整高清版).pdf
找到一本很详细的Linux Shell脚本教程,其实里面不光讲了Shell脚本编程,还介绍了系统的各种命令 http://vdisk.weibo.com/s/yVBlEojGMQMpv 本书共分五部分 ...
- 12day echo {1..100} << 三剑客命令
04. 直接编辑文件命令方法 a 如何直接在文件中添加单行内容 echo "oldboy" >>/oldboy/oldboy.txt 补充: echo命令用法说明: 0 ...
- CentOS初级扫盲
发行版介绍 Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX(可移植操作系统接口Portable Operating System Interface ,缩写为 POSIX ...
随机推荐
- HDU 4741 Save Labman No.004(计算几何)
题目链接 抄的模版...mark一下. #include <iostream> #include <cstring> #include <cstdio> #incl ...
- 【bzoj2002】[Hnoi2010]Bounce 弹飞绵羊 link-cut-tree
2016-05-30 11:51:59 用一个next数组,记录点x的下一个点是哪个 查询时,moveroot(n+1),access(x),splay(x) ,输出size[ch[x][0]]即为答 ...
- js之获取窗口大小和位置信息
除IE外的浏览器查看窗口大小和位置信息: //The overall size of the browser window on the desktop var windowWidth = windo ...
- LVS DR脚本 解析
vip.sh #!/bin/bash 192.168.2.240 broadcast 192.168.2.240 netmask 255.255.255.255 up route add -host ...
- 使用shell操作mysql(转)
在linux平台下,为避免每次操作数据库(mysql)都要进入Mysql命令模式下,可以使用Shell命令直接操作数据库. 一.直接写sql语句 if [ $# -ne 1 ] then ...
- MVVMLight Messenging
Basically there are two possible ways to send a message, first using an overload of the RaisePropert ...
- [LintCode] Longest Increasing Continuous Subsequence 最长连续递增子序列
Give an integer array,find the longest increasing continuous subsequence in this array. An increasin ...
- 安装配置redis
1.1查看当前系统环境 查看当前系统版本信息: 查看当前网络连通情况: 1.2使用yum安装 1.3确认redis的安装目录 1.4查看\修改配置文件 1.5启动redis服务并验证 1.6使用tel ...
- sql 数据库 初级 个人学习总结(一)
数据库个人总结(初级)1.增删改查 insert into 表名 values ('条件','条件2') delete from 表名 where 条件 update 表名 set=条件值 where ...
- 屏蔽Enter触发的事件
无论是 <button type="button" onclick="console.log('123');">123</button> ...