我有一个.pl文件,由非结构化标头和一些特定的XYZ结构组成.标题没有"." 在那里.您可以在下面找到此文件的片段:
Header (in total 29 lines)
ILINE
VRTX 1 545057.78564453125 3800905.201171875 -15000
VRTX 2 545184.49072265625 3800765.451171875 -15000
VRTX 3 545310.91650390625 3800625.970703125 -15000
SEG 1 2
SEG 2 3
ILINE
VRTX 136 551295.84606933594 3799015.443359375 -15000
VRTX 137 551293.82849121094 3798841.880859375 -15000
VRTX 138 551290.57849121094 3798661.892578125 -15000
SEG 136 137
SEG 137 138
Run Code Online (Sandbox Code Playgroud)
我想要实现的是将我的X和Y值的小数点移到左边,如下所示:
VRTX 1 5450.5778564453125 38009.05201171875 -15000
VRTX 2 5451.8449072265625 38007.65451171875 -15000
VRTX 3 5453.1091650390625 38006.25970703125 -15000
Run Code Online (Sandbox Code Playgroud)
我认为正则表达式可能有所帮助,但我没有使用Python和Shell的经验.任何帮助表示赞赏.
复制和粘贴友好的vim解决方案
:g/VRTX/normal f.xhhP;xhhP
Run Code Online (Sandbox Code Playgroud)
说明: