每隔6和7行打印一次

时间:2015-08-29 20:30:42

标签: fortran

我想写一个FORTRAN编程来读取所有行,我想从输出文件中每隔7行和第8行打印由空行分隔的每组数据。我输入了一个输入文件。请帮帮我。

提前谢谢!

 -4.164945E+05  3.001334E+02 -4.772577E+05  7.889016E+04 -5.561479E+05
  0.000000E+00  0.000000E+00  0.000000E+00  0.000000E+00 -4.088580E+05
  2.997668E+02  3.848513E+04 -1.806741E+06  5.561488E+05  0.000000E+00
  0.000000E+00  0.000000E+00  0.000000E+00  2.284295E+05  0.000000E+00
  0.000000E+00  0.000000E+00  9.000000E+01  9.000000E+01  9.000000E+01
  0.000000E+00  5.478642E-01  0.000000E+00  0.000000E+00  0.000000E+00
  0.000000E+00  4.667412E-01 -2.655381E-01 -2.928033E-01 -2.655381E-01
  5.437324E-01  1.816853E-01 -2.928033E-01  1.816853E-01  6.331191E-01

 -4.165192E+05  3.002662E+02 -4.773093E+05  8.116229E+04 -5.584716E+05
  0.000000E+00  0.000000E+00  0.000000E+00  0.000000E+00 -4.012512E+05
  2.993096E+02  1.573615E+04 -1.839001E+06  5.584725E+05  0.000000E+00
  0.000000E+00  0.000000E+00  0.000000E+00  2.284295E+05  0.000000E+00
  0.000000E+00  0.000000E+00  9.000000E+01  9.000000E+01  9.000000E+01
  0.000000E+00  1.095372E+00  0.000000E+00  0.000000E+00  0.000000E+00
  0.000000E+00  1.223969E+00 -2.234850E-04 -1.602426E-01 -2.234850E-04
  1.005241E+00  2.884689E-02 -1.602426E-01  2.884689E-02  1.056905E+00

 -4.165735E+05  3.013409E+02 -4.775812E+05  7.969518E+04 -5.572764E+05
  0.000000E+00  0.000000E+00  0.000000E+00  0.000000E+00 -4.067039E+05
  3.015952E+02  3.190769E+04 -1.818406E+06  5.572773E+05  0.000000E+00
  0.000000E+00  0.000000E+00  0.000000E+00  2.284295E+05  0.000000E+00
  0.000000E+00  0.000000E+00  9.000000E+01  9.000000E+01  9.000000E+01
  0.000000E+00  7.080812E-01  1.157779E+00  1.385668E+00  5.455691E-01
  2.982146E-01  5.921261E-01  7.954344E-02  1.724112E-01  7.954344E-02
  7.981127E-01 -3.378208E-02  1.724112E-01 -3.378208E-02  7.340048E-01

 -4.165731E+05  2.994772E+02 -4.772035E+05  8.034912E+04 -5.575527E+05
  0.000000E+00  0.000000E+00  0.000000E+00  0.000000E+00 -4.041375E+05
  2.974779E+02  2.428109E+04 -1.827365E+06  5.575535E+05  0.000000E+00
  0.000000E+00  0.000000E+00  0.000000E+00  2.284295E+05  0.000000E+00
  0.000000E+00  0.000000E+00  9.000000E+01  9.000000E+01  9.000000E+01
  0.000000E+00  8.921716E-01  1.969410E+00  2.318855E+00  7.271637E-01
  6.363283E-01  7.974565E-01 -1.911601E-01 -9.800037E-02 -1.911601E-01
  7.979089E-01 -5.302858E-02 -9.800037E-02 -5.302858E-02  1.081150E+00

1 个答案:

答案 0 :(得分:0)

如果你确定你的数据都有8行,每行有一个分隔线,一行最多80个字符,你可以做

div {
    display: inline-block;
    width: 320px;
    vertical-align: top;
}

这将在计算行数时逐行读取输入文件,直到达到文件结尾(或其他读取错误,以避免无限循环)。如果行号与7-8-9模9一致,那么它将打印它(这将自动保持分隔线)。