Bash Commands - tr cat tac
来源:互联网 发布:以公司名义开淘宝店 编辑:程序博客网 时间:2024/05/18 18:18
1. tr
character translation filter.
1.1
Either tr "A-Z" "*" <filename or tr A-Z \* <filename
changes all the uppercase letters in filename to asterisks (writes to stdout). On some systems this may not work, but tr A-Z '[**]' will.
1.2
The -d option deletes a range of characters.
echo "abcdef" # abcdef
echo "abcdef" | tr -d b-d # aef
tr -d 0-9 <filename # Deletes all digits from the file "filename".
1.3
The --squeeze-repeats (or -s) option deletes all but the first instance of a string of
consecutive characters. This option is useful for removing excess whitespace.
echo "X3XXXX" | tr --squeeze-repeats 'X' # X3X
1.4
those characters not matching the specified set.
bash$ echo "acfdeb123" | tr -c b-d + # +c+d+b++++
2. cat
cat, an acronym for concatenate, lists a file to stdout. When combined with redirection (> or >>), itis commonly used to concatenate files
2.1
cat file.1 file.2 file.3 > file.123 # Combines three files into one.
2.2
The -n option to cat inserts consecutive numbers before all lines of the target file(s).
The -b option numbers only the non-blank lines.
The -v option echoes nonprintable characters, using ^ notation.
The -s option squeezes multiple consecutive blank lines into a single blank line.
2.3
In a pipe, it may be more efficient to redirect the stdin to a file, rather than to cat the file.
cat filename | tr a-z A-Ztr a-z A-Z < filename # Same effect, but starts one less process, and also dispenses with the pipe.
3. tac
tac, is the inverse of cat, listing a file backwards from its end.
3.1
tac errorfix
c
b
a
cat errorfix
b
c
- Bash Commands - tr cat tac
- cat、tac、rev
- Linux指令--cat,tac
- cat,tac与rev命令
- linux之cat和tac
- cat and tr << <<-
- 关于LINUX中的cat、tac、rev命令
- Linux显示文件命令之cat/tac
- Linux tac --与cat相反的命令
- 文本查看命令 - cat和tac
- 初学linux命令-cd、cat、tac
- Linux命令(1)-cat & 反向tac
- Bash Commands - Special Charactors # ? $
- Bash Commands - $ # Variable Substitution
- Bash Commands - Comparison Operators
- Bash Commands - chmod # Invoking script
- Bash Commands - # Integer or string?
- Bash Commands - Arithmetic Tests using (( ... ))
- android编译产生的apk或so不安装 .
- xcode archive 不能够打包成ipa,生成的却是xcarchive
- erase方法的正确使用
- Iterator迭代器
- self :: 和 this-> 的区别
- Bash Commands - tr cat tac
- 关于手机分辨率相关术语和概念
- Oracle内建包UTL_FILE,UTL_HTTP,UTL_SMTP,UTL_TCP使用说明
- NSLog的使用方法
- android的call与Phone的实现分析
- Objective C--建造者模式
- make menuconfig 时,出现错误:unable to find the ncurses libraries
- Java多线程编程--(7)学习Java5.0 并发编程包--Lock & Condition
- win8应用开发之一:创建一个使用 C#/VB 和 XAML 的 Metro 风格应用