参考文档

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

 

相关文章:

  • 2021-12-26
  • 2021-04-08
  • 2022-12-23
  • 2021-04-30
  • 2021-05-04
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-29
  • 2021-10-24
  • 2022-12-23
  • 2021-04-24
  • 2021-10-05
  • 2021-07-25
  • 2022-12-23
相关资源
相似解决方案