##准备测试文件:
[root@zabbix-agent opt]# while read line ;do echo ${line%% *};done < stu.txt
01 oldboy 18
02 lidao 17
03 baojewery 66
04 happyday 9
05 oldcao 99
##获取文件中的序号::::%从右边向左边删除:
[root@zabbix-agent opt]# while read line ;do echo ${line%% *};done < stu.txt
01
02
03
04
05
[root@zabbix-agent opt]# while read line ;
> do
> echo ${line%% *} ###########直到删除右边的空格为止
> done < stu.txt
01
02
03
04
05
标签:脚本,opt,###%%%%%%%%%%,agent,echo,zabbix,done,line%,用法 From: https://www.cnblogs.com/cherishthepresent/p/17848835.html