Skip to content

Commit 8980bfc

Browse files
authored
Update cut.md (#458)
截取最后N 个字符
1 parent 323db5a commit 8980bfc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

command/cut.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,17 @@ efghijklmnopqrstuvwxyz
157157
efghijklmnopqrstuvwxyz
158158
```
159159

160+
打印最后5个字符:
161+
162+
遗憾的是, `cut`并没有提供最后字符的支持. 不过我们可以通过字符串反转来实现.
163+
164+
```shell
165+
[root@localhost text]# cat test.txt| rev | cut -c -5 | rev
166+
vwxyz
167+
vwxyz
168+
vwxyz
169+
vwxyz
170+
vwxyz
171+
```
172+
160173
<!-- Linux 命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->

0 commit comments

Comments
 (0)