Bir*_*rei 414
两种方式:
按Ctrl+V然后Tab使用“逐字”引用的 insert。
cut -f2 -d' ' infile
Run Code Online (Sandbox Code Playgroud)
或这样写以使用ANSI-C 引用:
cut -f2 -d$'\t' infile
Run Code Online (Sandbox Code Playgroud)
Mik*_*kel 256
选项卡是默认设置。
请参阅剪切手册页。
-d delim
Use delim as the field delimiter character instead of the tab
character.
Run Code Online (Sandbox Code Playgroud)
所以你应该写
cut -f 2
Run Code Online (Sandbox Code Playgroud)
小智 16
awk -F '\t' '{ print $2 }' inputfile
Run Code Online (Sandbox Code Playgroud)
这将从 中提取每行输入的第二个制表符分隔字段inputfile。
nob*_*bar 11
更一般地说,不需要任何不可见的字符:tr用于将分隔符转换为可以更轻松地指定为cut.
$ echo -e "a\tb\tc" |tr '\t' ' ' |cut -d' ' -f2
b
Run Code Online (Sandbox Code Playgroud)
tr 是一个简单但功能强大的字符匹配和替换工具。