ファイル名はfile1
です。私はline- 10
の内容をコピーし、新しい含むFileContentは、私が個別に行を削除する方法を知っているのsedを使用してファイル内の行番号を `n1`から` n2`までの行番号に変更します。
1 intst
2 1.0
3 12.591870 0.000000 0.000000
4 0.000000 12.591870 0.000000
5 0.000000 0.000000 12.591870
6 Ba Zr Al O
7 27 26 1 81
8 direct
9 0.166667 0.166666 0.167762 Ba
10 0.166666 0.166667 0.832238 Ba #Original line- 11
...
...
59 0.666668 0.666666 0.329117 Zr
60 0.666665 0.666667 0.670884 Zr
61 0.666667 0.666667 1.000000 Al
62 0.166667 0.166667 0.500000 Ba #Original line-10
63 0.166667 0.999071 0.999999 O
として表示されるように新しい行を作成することによってline-62
の下に移動する必要があり
1 intst
2 1.0
3 12.591870 0.000000 0.000000
4 0.000000 12.591870 0.000000
5 0.000000 0.000000 12.591870
6 Ba Zr Al O
7 27 26 1 81
8 direct
9 0.166667 0.166666 0.167762 Ba
10 0.166667 0.166667 0.500000 Ba #Line to be moved
11 0.166666 0.166667 0.832238 Ba
...
...
60 0.666668 0.666666 0.329117 Zr
61 0.666665 0.666667 0.670884 Zr
62 0.666667 0.666667 1.000000 Al #Moved line to be inserted below this line
63 0.166667 0.999071 0.999999 O
sed -i.bkp -e '10d' file
と行を挿入する
sed -i '10i <string>'file1
しかし、私は
例@lurker "移動" を示唆しています。 –