我可以很好地将数据插入Excel,但是有问题。
我想在最后插入的数据下方看到我插入的数据,但是它在屏幕快照的下方显示,如黑色圆圈所示。
这是我的代码:
$ cat tst.awk
BEGIN { OFS="," }
{
tag = $1
val = ( match($0,/"[^"]*"/) ? substr($0,RSTART,RLENGTH) : $NF )
if ( tag == "port" ) {
ports[++numPorts] = val
}
else {
vals[++numVals] = val
}
}
tag == "exit" {
for (portNr=1; portNr<=numPorts; portNr++) {
for (valNr=1; valNr<numVals; valNr++) {
printf "%s%s", vals[valNr], OFS
}
print ports[portNr]
}
numPorts = numVals = 0
}
$ awk -f tst.awk file
1,"LAG-1 GOES TO LAG-2",32770,1/2/1
1,"LAG-1 GOES TO LAG-2",32770,1/2/2
1,"LAG-1 GOES TO LAG-2",32770,3/2/3
10,"REMOVED-LAG-10-0.0.0.0",32771,4/1/1
10,"REMOVED-LAG-10-0.0.0.0",32771,5/1/1
11,"REMOVED-LAG-11-4.4.4.4",32772,5/1/2