Update cut.md (#458)

截取最后N 个字符
This commit is contained in:
烟草的香味 2022-12-03 17:03:33 +08:00 committed by GitHub
parent 323db5aced
commit 8980bfcc35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

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