zl程序教程

您现在的位置是:首页 >  系统

当前栏目

Linux命令详解cut命令

Linux命令 详解 cut
2023-09-14 09:13:15 时间

Linux命令详解cut命令

1.cut命令

cut - remove sections from each line of files

2.参数详解

  • -f:指定输出某个字段
-f, --fields=LIST
              select only these fields;  also print any line that contains no delimiter character, unless the -s option is specified
  • -d:指定使用某个分隔符
-d, --delimiter=DELIM
       use DELIM instead of TAB for field delimiter

3.示例

[root@server4 shells]# echo 'asd;hello;wawa;' | cut --delimiter=';' -f1
asd
[root@server4 shells]# echo 'asd;hello;wawa;' | cut -d\; -f1
asd