见下文我有我想要格式化的这些数据,以便我可以将这些数据插入到 mysql 表中。
fdsfsfrerwrwrwr_Core 55000:10011608 ipv4 Vl1162
xcvbdtykgjfhffghrfhfhffghCore 55000:10014478 ipv4 Vl1447
675436346ore 55000:1004868 ipv4
545_Core 55000:1004128 ipv4
345235345 55000:2728 ipv4
534534e 55000:1002108 ipv4 Vl2105
C8567566756Core 55000:10021038 ipv4 Vl2103
C546346453554_Core 55000:2105898 ipv4 Vl664
Vl896
ewttt_WAN_Core 55000:1007967 ipv4 Vl2552
tetrewCore 55000:1001708 ipv4 Vl905
gsdgdsfgore 55000:100106 ipv4
65434533_Core 55000:1009418 ipv4 Vl941
Vl1028
I2222222-11 55000:10008 ipv4
I666r555-12 55000:20002 ipv4 Vl749
Vl874
Vl894
Vl942
Vl1172
Vl1439
Vl2553
345345353Core 55000:1004068 ipv4 Vl50
5345345Core 55000:1004498 ipv4 Vl617
S534534 55000:1002798 ipv4 Vl779
534535335Core 55000:1004278 ipv4
test 55000:500500 ipv4
我想使用 AWK 或任何其他工具来产生类似于以下的结果,以便我可以将此数据插入 mysql 数据库。我使用了以下 AWK 命令。猫样本.data | awk '{打印 $1","$2","$3","$4}'
TEST1_Core,990010:10011608,ipv4,Vl1162
AA2_Autism_Core,990010:10014478,ipv4,Vl1447
6753312_Core,990010:1004868,ipv4,
542343423,990010:1004128,ipv4,
Bgdfdfgdf,990010:2728,ipv4,
gfgCore,990010:1002108,ipv4,Vl2105
fgdfgfgdfg_Core,990010:10021038,ipv4,Vl2103
42342342342342Core,990010:2105898,ipv4,Vl664
请注意,最后一列有多行关联到一条记录。
ghfghfhdfCore 990010:1009418 ipv4 Vl941
Vl1028
hfghfghdf11 990010:10008 ipv4
yreyryer-12 990010:20002 ipv4 Vl749
Vl874
Vl894
Vl942
Vl1172
Vl1439
Vl2553
如何将最后一列转换为多行,以便我可以跟踪结果。
ghfghfhdfCore,990010:1009418,ipv4,Vl941 Vl1028
hfghfghdf11,990010:10008,ipv4,
yreyryer-12,990010:20002,ipv4,Vl749 Vl874 Vl894 Vl942 Vl1172 Vl1439 Vl2553
我相信一定有人能够帮助我解决这个问题。