Linux命令详解cut命令

版权声明:如若转载,请联系作者。 https://blog.csdn.net/liu16659/article/details/83444535

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

猜你喜欢

转载自blog.csdn.net/liu16659/article/details/83444535