第一步,删除不包含空格的行,只剩以下行:
root -168.508667 59.921909 -356.349030 -5.081 0 0
mashen01 0.00889565 -0.019277 -0.00694713 9.47 0.49 0
mashen02 3.37824e-018 -0.00496174 -0.0194649 2.17 0.12 0
root -168.491898 59.663021 -355.058594 -6.311 0.004 0
mashen01 0.00889565 -0.039272 -0.00227861 8.83 0.49 0
mashen02 7.00933e-018 -0.0112191 -0.0548335 -0.68 0.12 0
...
详细步骤:
1. ctrl-o打开txt文件
2. ctrl-h打开replace窗口
replace unit选择Line
search for pattern 输入"\s"(不带双引号)
去掉print unmatched unit 选项
replace with pattern输入"$match\n"(不带双引号)
3. 点击Replace
第二步,排序,变成:
mashen01 0.00889565 -0.039272 -0.00227861 8.83 0.49 0
mashen01 0.0117775 -0.058414 0.00321398 5.93 0.64 0
mashen01 0.0145563 -0.0707497 0.00755729 1.45 0.79 0
mashen01 0.0172585 -0.071797 0.00752022 -1.95 0.93 0
mashen02 3.37824e-018 -0.00496174 -0.0194649 2.17 0.12 0
mashen02 7.00933e-018 -0.0112191 -0.0548335 -0.68 0.12 0
mashen02 -1.87379e-018 -0.0160994 -0.104087 -3.26 0.16 0
mashen02 4.48111e-017 -0.0197861 -0.149891 -4.95 0.20 0
mashen02 5.17543e-017 -0.021659 -0.167983 -5.27 0.23 0
root -168.508667 59.921909 -356.349030 -5.081 0 0
root -168.491898 59.663021 -355.058594 -6.311 0.004 0
root -168.469650 59.270657 -353.777130 -5.759 0.008 0
root -168.442093 59.037426 -352.483429 -3.441 0.012 0
root -168.409348 58.978054 -351.167816 -0.079 0.017 0
详细步骤:
4. ctrl-h打开replace窗口
在Replace with pattern输入"sort_by_word($match,1,1)"(不带双引号)
5. 点击Replace
第三步,每段5行,按段转置,变成:
mashen01 mashen01 mashen01 mashen01 mashen01
0.00889565 0.00889565 0.0117775 0.0145563 0.0172585
-0.019277 -0.039272 -0.058414 -0.0707497 -0.071797
-0.00694713 -0.00227861 0.00321398 0.00755729 0.00752022
9.47 8.83 5.93 1.45 -1.95
0.49 0.49 0.64 0.79 0.93
0 0 0 0 0
mashen02 mashen02 mashen02 mashen02 mashen02
3.37824e-018 7.00933e-018 -1.87379e-018 4.48111e-017 5.17543e-017
-0.00496174 -0.0112191 -0.0160994 -0.0197861 -0.021659
-0.0194649 -0.0548335 -0.104087 -0.149891 -0.167983
2.17 -0.68 -3.26 -4.95 -5.27
0.12 0.12 0.16 0.20 0.23
0 0 0 0 0
root root root root root
-168.508667 -168.491898 -168.469650 -168.442093 -168.409348
59.921909 59.663021 59.270657 59.037426 58.978054
-356.349030 -355.058594 -353.777130 -352.483429 -351.167816
-5.081 -6.311 -5.759 -3.441 -0.079
0 0.004 0.008 0.012 0.017
0 0 0 0 0
...
详细步骤:
6. ctrl-h打开replace窗口
7. replace unit选Paragraph
8. replace with pattern输入transpose($match,' ', ' ')
9. 选settings选项页,在中间选中Fixed Para Lines,后面输入5
10. 点击Replace.
第四步,每段7行,对每段进行处理,得到最后结果,详细步骤:
11. ctrl-h打开replace窗口
12. Replace Unit选成Line
Replace Scope选成Paragraph
13. Replace with Pattern输入$A
14. 选Advanced页,insert begin text输入:
{
rate = 24
start = 1
tracklength = 5
tracks = 6
15. Run following for each matched unit输入:
if ($line_no==1) {$B=$match[1];$A="";}
else {
$A=" {
name = $B.".('tx','ty','tz','rx','ry','rz')[$line_no-2]."
data = $match
}\n"
}
16. insert end text输入}
17. 选中Settings页,在Fixed Para Lines输入7
18. 点击Replace,完成!
可以把以上步骤选中并保存供以后重复使用。