cut截取数据

参考文档

https://blog.csdn.net/caoshunxin01/article/details/79355566

[root@kube-node3 ~]# cat tab_space.txt

this is tab finish.
this is several space finish

[root@kube-node3 ~]# cat tab_space.txt | grep this | sed -n '1p' | cut -d ' ' -f 1
this


在 /etc/passwd 中输出第 3-5 列:
cat /etc/passwd | cut -d ':' -f 3-5


在 /etc/passwd 中输出第 3到最后一列
cat /etc/passwd | cut -d ':' -f 3-


cut字符串截取 http://blog.51cto.com/2627lounuo/1790446

去掉最后面的 && : 截取最后面&&的所有左端字符

[root@oracledb ~]# cat c.sh
yum -y install binutils && yum -y install compat-libcap1 &&
[root@oracledb ~]# str=`cat orcale_output.sh`
[root@oracledb ~]# echo ${str}
yum -y install binutils && yum -y install compat-libcap1 &&
[root@oracledb ~]# cut=${str%&&*}
[root@oracledb ~]# echo ${cut}
yum -y install binutils && yum -y install compat-libcap1

原文地址:https://www.cnblogs.com/effortsing/p/9981908.html