转换前的格式

转换后的格式


80:D0:9B:0E:13:**

60:F8:1D:C9:CB:**

98:FE:94:3D:32:**

BC:85:56:3D:D9:**


[root@pc0003 huawei.mac.manager]# mysql -h192.168.***** -pa****  -Ne "use glpi;select glpi_devicenetworkcards.designation, upper(glpi_items_devicenetworkcards.mac) from glpi_items_devicenetworkcards,glpi_devicenetworkcards  where glpi_items_devicenetworkcards.devicenetworkcards_id = glpi_devicenetworkcards.id and glpi_devicenetworkcards.designation=\"Wireless\"" | egrep -o "([0-9a-fA-F]{2})(([/\s:][0-9a-fA-F]{2}){5})" | sed 's/://g'|sed -r 's/^(.{4})(.{4})(.{4})$/\1-\2-\3/g'


80D0-9B0E-13**

60F8-1DC9-CB**

98FE-943D-32**

BC85-563D-D9**



root@ubuntu:/home# echo "20061121155230" |awk  'BEGIN{FS=""}{print $1$2$3$4"-"$5$6"-"$7$8" "$9$10":"$11$12":"$13$14}'
2006-11-21 15:52:30


root@ubuntu:/home# echo "20061121155230" |awk -F "" '{print $1$2$3$4"-"$5$6"-"$7$8" "$9$10":"$11$12":"$13$14}'

2006-11-21 15:52:30