cut字符串截取

cut字符串截取code

-d 按字節截取

[root@slave elk]# ll
total 0
drwxr-xr-x. 6 root root 194 Jan 24 16:15 bigdesk
截取前2個字節
[root@slave elk]# ll |cut -b1-2
to
dr
截取第2個字節
[root@slave elk]# ll |cut -b2
o
r

-d 指定分隔符

cut -d" "

-f 按分隔域截取

[root@slave elk]# ll |cut -d" " -f1
total
drwxr-xr-x.

-c 按字符數截取

[root@slave elk]# ll |cut  -c15-18

root
相關文章
相關標籤/搜索