To use the data from a publisher software, I have functions that I can call via the CLI (Linux Shell).
其中一人以以下格式向我汇报数据:
2601424 OPTDCBO3 EERP O 0254 5512240 TDCTAC01 B 00 0000000 N N
2602451 WHA EERP O 0254 5512353 03ZEE003 B 00 0000000 N N
2602748 OPTDCBO4 EERP O 0254 5512380 TDCTAC01 B 00 0000000 N N
2603290 OPTDCBO3 EERP O 0254 5512440 TDCTAC01 B 00 0000000 N N
2604594 OPTDCBO3 EERP O 0254 5512560 TDCTAC01 B 00 0000000 N N
2605631 OP49LDB1 TRAN O 0254 EDRZZZ02 B 2605627-EDR 00 0000000 N N
2605657 OP49LDB1 TRAN O 0254 EDRZZZ02 B 2605652-EDR 00 0000000 N N
2605663 OP49LDB1 TRAN O 0254 EDRZZZ02 B 2605653-EDR 00 0000000 N N
2606116 OPTDCBO3 EERP O 0254 5513080 TDCTAC01 B 00 0000000 N N
2716077 OPTDCBO3 EERP O 0255 5610080 TDCTAC01 B 00 0000000 N N
2716564 SOG01 TRAN O 0255 s2716564 TACSOG01 B 2716504-TAC 00 0000000 N N
2718631 OPTDCBO3 EERP O 0255 5610160 TDCTAC01 B 00 0000000 N N
7158273 OPTDCBO4 EERP O 0251 5203300 TDCTAC01 B 00 0000000 N N
7158672 WHA EERP O 0251 5203342 03ZEE001 B 00 0000000 N N
7158939 ZZZA4 LIST O 0251 B 7158938-49W 00 0000000 N N
7158978 OPTDCBO3 EERP O 0251 5203400 TDCTAC01 B 00 0000000 N N
7159853 OPTDCBO4 EERP O 0251 5203540 TDCTAC01 B 00 0000000 N N
2724704 SOU02 TRAN I 0255 s2724704 FTP_B E 2724704-SOU 00 0000000 N N
2724707 PRODS2I EERP O 0255 6219255 S2IRCE03 E 00 0000000 N N
2724708 SOU01 TRAN I 0255 s2724708 FTP_B E 2724708-SOU 00 0000001 N N
2724709 SON01 TRAN O 0255 s2724709 SOUSON11 E 2724708-SOU 00 0000001 N N
A space separates the first 5 columns, and one or two spaces separate the 5th and 6th columns. Sometimes columns 6 and 7 are empty.
目的是将一部分或全部数据归还给每个领域之间的限定文本档案。
为检索第1和第7栏,我使用了:
command | awk -F" " { print $1,$7 }
但它规定:
2603290 TDCTAC01
2604594 TDCTAC01
2605631 B
2605657 B
2605663 B
2606116 TDCTAC01
2606214 TDCTAC01
7158672 03ZEE001
7158939 7158938-49W
7158978 TDCTAC01
Awk将填满空间的栏目视为多个相邻的分离器,而不是一个空栏,因此退回了以下非排他列的数据。
我如何获得X多个空间的顺序,这些空间被视为空栏,而有时有两个空间分立两栏?
Column N°6 can be composed of 1 to 6 numeric characters, so you cannot simply use a fixed width to delimit the column.