I am trying to do post processing using a bash script. One of the step is to copy from lines below certain line of the file to another file. For example, my file result.txt looks like this
6798
Atoms. Timestep: 0
1 -1.13977 -2.85824 -1.22655
1 -1.20925 -3.25439 -0.978641
1 -1.54565 -2.93301 -1.10555
1 -0.736167 -2.71201 -1.28063
1 -0.807178 -3.16856 -1.13489
1 -0.44354 -3.03183 -1.23103
1 -0.357782 -3.39866 -1.0277
1 -0.0431648 -3.05734 -1.23315
6798
Atoms. Timestep: 1
1 0.119814 -3.40483 -1.03653
1 0.382198 -3.03771 -1.23183
1 0.580509 -3.37434 -1.02215
1 0.818628 -3.00063 -1.21422
1 1.0244 -3.31469 -0.980957
1 1.27482 -2.97232 -1.15564
I want only the part below Atoms. Timestep: 1
. It is very easy to do it manually, however, there are thousands of file like that so that i want to use bash script to do it for me. I have checked several method from google however, they are not that fit from my question. If you have experience in that it would be nice to post your result below. That may help others who have similar problem like me.
Thank you in advance!
FINAL SOLUTION
My final solution is as guys mentioned below, I make a conclusion.
sed -n '/Atoms. Timestep: 1/, $ p' < result.txt > resultParsed.txt
sed -i '/Atoms. Timestep: 1/d' resultParsed.txt
The first line will get the content including and after Atoms. Timestep: 1. The second line will delete the line that you don't need.