- 论坛徽章:
- 0
|
请帮忙看看我的数据提取问题出在哪里了,谢谢!
原始数据如下:
1A-00h:1A-G00
1B-00h:1B-G00
1C-00h:1C-G00
1C-01h:HA5-ZW050
1D-00h:1D-G00
1D-01h:HA5-QK03_
1E-00h:1E-G00
1F-00h:1F-G00
1G-00h:1G-G00
1G-01h:HA5-ZW050
1H-00h:1H-G00
1H-01h:HA5-QK03_
2A-00h:2A-G00
2B-00h:2B-G00
2C-00h:2C-G00
2C-01h:HA5-ZW050
2D-00h:2D-G00
2D-01h:HA5-QK03_
2E-00h:2E-G00
2F-00h:2F-G00
2G-00h:2G-G00
2G-01h:HA5-ZW050
2H-00h:2H-G00
2H-01h:HA5-QK03_
3A-00h:3A-G00
3B-00h:3B-G00
3B-01h:JS0506
3C-00h:3C-G00
3C-01h:HA5-ZW050
3D-00h:3D-G00
3E-00h:3E-G00
3F-00h:3F-G00
3F-01h:JS0506
3G-00h:3G-G00
3G-01h:HA5-ZW050
3H-00h:3H-G00
4A-00h:4A-G00
4B-00h:4B-G00
4B-01h:JS0506
4C-00h:4C-G00
4C-01h:HA5-ZW050
4D-00h:4D-G00
4E-00h:4E-G00
4F-00h:4F-G00
4F-01h:JS0506
4G-00h:4G-G00
4G-01h:HA5-ZW050
4H-00h:4H-G00
5A-00h:5A-G00
5B-00h:5B-G00
5C-00h:5C-G00
5D-00h:5D-G00
5D-01h:IBMtest03
5E-00h:5E-G00
5F-00h:5F-G00
5G-00h:5G-G00
5H-00h:5H-G00
5H-01h:IBMtest03
6A-00h:6A-G00
6B-00h:6B-G00
6C-00h:6C-G00
6D-00h:6D-G00
6D-01h:IBMtest03
6E-00h:6E-G00
6F-00h:6F-G00
6G-00h:6G-G00
6H-00h:6H-G00
6H-01h:IBMtest03
7A-00h:7A-G00
7B-00h:7B-G00
7B-01h:XPPA
7C-00h:7C-G00
7D-00h:7D-G00
7D-01h:HA5-QK01_
7E-00h:7E-G00
7F-00h:7F-G00
7F-01h:XPPA
7G-00h:7G-G00
7H-00h:7H-G00
7H-01h:HA5-QK01_
8A-00h:8A-G00
8B-00h:8B-G00
8B-01h:XPPA
8B-02h:XPLS
8C-00h:8C-G00
8D-00h:8D-G00
8D-01h:HA5-QK01_
8E-00h:8E-G00
8F-00h:8F-G00
8F-01h:XPPA
8G-00h:8G-G00
8H-00h:8H-G00
8H-01h:HA5-QK01_
我写的perl代码如下:
perl -lan -F: -e 'print @F[0]=~s/[0-9][A-Z]-.*h/[0-9][A-Z/g,":", @F[1]'
代码执行结果如下:
.
.
.
1:HA5-QK01_
1:7E-G00
1:7F-G00
1:XPPA
1:7G-G00
1:7H-G00
1:HA5-QK01_
1:8A-G00
1:8B-G00
.
.
.
我想得到的结果是如下的输出格式:
8B:XPPA
8B:XPLS
8C:8C-G00
8D:8D-G00
|
|