00-*_*alo 12 command-line cut-command
假设一个名为“file”的文件包含以下行:
foo:bar:baz:qux:quux
one:two:three:four:five:six:seven
alpha:beta:gamma:delta:epsilon:zeta:eta:theta:iota:kappa:lambda:mu
the quick brown fox jumps over the lazy dog
Run Code Online (Sandbox Code Playgroud)
如果我们使用带有这些选项的 cut 命令,我们会得到:
$ cut -d ":" -f 5- file
quux
five:six:seven
epsilon:zeta:eta:theta:iota:kappa:lambda:mu
the quick brown fox jumps over the lazy dog
Run Code Online (Sandbox Code Playgroud)
在最后一行中,没有找到冒号字符,所以通常它不应该占用该行,因为我们从第 5 个字段开始到行尾。
为什么呢 ?
Flo*_*sch 16
默认情况下cut,该-f选项打印任何不包含分隔符的行。-s如果您不想要它们,请使用:
$ cut -d ":" -f 5- -s file
quux
five:six:seven
epsilon:zeta:eta:theta:iota:kappa:lambda:mu
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1384 次 |
| 最近记录: |