id | status | name | cluster | ip | mac | roles | pending_roles | online
---|----------|------------------|---------|-------------|-------------------|-------|-----------------|-------
11 | discover | Untitled (9a:3a) | 12 | 10.20.0.144 | c8:1f:66:ce:9a:3a | | cinder | True
12 | discover | Untitled (9f:8d) | 12 | 10.20.0.186 | c8:1f:66:ce:9f:8d | | cinder, compute | True
10 | discover | Untitled (c7:f3) | None | 10.20.0.214 | c8:1f:66:ce:c7:f3 | | | True
13 | discover | Untitled (9f:3d) | None | 10.20.0.233 | c8:1f:66:ce:9f:3d | | | True
8 | discover | Untitled (74:8e) | 12 | 10.20.0.184 | c8:1f:66:ce:74:8e | | controller | True
14 | discover | Untitled (75:4b) | None | 10.20.0.185 | c8:1f:66:ce:75:4b | | | True
9 | discover | Untitled (76:23) | None | 10.20.0.213 | c8:1f:66:ce:76:23 | | | True
我正則表達式:
\d+)\s+\|\s+(\w+)\s+\|\s+\w+\s+\((\S+)\)\s+\|\s+(\d+)\s+\|\s+(\S+)\s+\|\s+(\S+)\s+\|(.*?)\|(.*?)\|\s+(\w+)
,但不能趕上空單元格!我嘗試了很多方法。
行示例:
13 | discover | Untitled (9f:3d) | None | 10.20.0.233 | c8:1f:66:ce:9f:3d | | | True
當你有分隔數據,它更容易使用['split'](http://perldoc.perl.org/functions/ split.html)(或['Text :: CSV'](https://metacpan.org/pod/Text::CSV)如果字段可以包含分隔符)。 – ThisSuitIsBlackNot 2015-04-02 17:21:07
鏈接到文本文件http://textuploader.com/xcda – 2015-04-02 17:22:20
請不要將輸入數據放在場外。如果鏈接中斷,未來訪問此頁面的用戶將無法看到數據,問題將不再有意義。 – ThisSuitIsBlackNot 2015-04-02 17:26:35