[[email protected]_m ~]# awk ‘{print $0}‘ install.log.syslog |head -1
<86>Feb 29 02:58:28 groupadd[1598]: group added to /etc/group: name=dbus, GID=81
不想要的话就$num="" 并用分号结尾
[[email protected]_m ~]# awk ‘{$2="";print $0}‘ install.log.syslog |head -1
<86>Feb 02:58:28 groupadd[1598]: group added to /etc/group: name=dbus, GID=81
for循环打印列
[[email protected]_m ~]# awk ‘{for(i=2;i<NF;i++)printf("%s ",$i);printf("\n")}‘ install.log.syslog |head -1
29 02:58:28 groupadd[1598]: group added to /etc/group: name=dbus,
时间: 2024-10-09 20:16:56