I have a fairly simple problem, but I have no experience with Perl and little time to learn it. I have this text file as an input:
Log file 'LOG\atgt.txt'
ELAPSED_SIM_TIME Seconds
AACS_Mode state
ASGN_SlewMode state
ATT_Mode state
ECI2IRU_Q[0] none
ECI2IRU_Q[1] none
ECI2IRU_Q[2] none
ECI2IRU_Q[3] none
RWA[0].Rpm rpm
RWA[1].Rpm rpm
RWA[2].Rpm rpm
RWA[3].Rpm rpm
ANAV_Eclipsed flag
1 1 0 3 8.54E-08 2.59E-08 -5.98E-08 1 1.295752618 1.2989038 5.495479291 -9.591810973 0
2 1 0 3 1.89E-06 5.20E-08 1.07E-06 1 5.612838988 5.626486779 23.80152215 -41.80307628 0
3 1 0 3 5.36E-06 1.96E-07 9.96E-06 1 9.926691625 9.950824754 42.08872415 -74.01484423 0
4 1 0 3 9.08E-05 4.12E-07 8.60E-06 1 14.2371683 14.27177551 60.35674405 -106.1841529 0
5 1 0 5 1.54E-05 7.62E-07 1.50E-05 1 18.54407687 18.58914691 78.62846211 -138.3115435 0
6 1 0 5 2.69E-05 2.27E-06 6.30E-05 0.999999999 22.84718311 22.90270475 96.88993192 -170.3976624 0
7 1 0 5 2.94E-05 1.70E-06 3.28E-05 0.999999999 27.1611309 27.21218229 115.1304895 -202.4432368 0
8 1 0 5 6.29E-05 2.29E-06 6.43E-05 0.999999998 31.472361 39.51729109 133.3494285 -234.4490483 0
9 1 0 5 7.82E-05 2.80E-06 5.74E-05 0.999999996 38.77891735 35.81773271 151.5460174 -269.4159032 0
And all I need from this file is the first column and the fifth through the eigth column. Then I want to take this data and put it into a file that looks like this:
stk.v.4.2
BEGIN Attitude
NumberofAttitudePoints 9
ScenarioEpoch 1 Sep 2007 12:00:00.00
AttitudeTimeQuaternions
1 8.54E-08 2.59E-08 -5.98E-08 1
2 1.89E-06 5.20E-08 1.07E-06 1
3 5.36E-06 1.96E-07 9.96E-06 1
4 9.08E-05 4.12E-07 8.60E-06 1
5 1.54E-05 7.62E-07 1.50E-05 1
6 2.69E-05 2.27E-06 6.30E-05 0.999999999
7 2.94E-05 1.70E-06 3.28E-05 0.999999999
8 6.29E-05 2.29E-06 6.43E-05 0.999999998
9 7.82E-05 2.80E-06 5.74E-05 0.999999996
Where the "NumberofAttitudePoints" must display the number of rows of data copied over (9). If anyone has any input I would really appreciate it, I've been having trouble finding help on this probably because it is such a basic task. Thanks
Log file 'LOG\atgt.txt'
ELAPSED_SIM_TIME Seconds
AACS_Mode state
ASGN_SlewMode state
ATT_Mode state
ECI2IRU_Q[0] none
ECI2IRU_Q[1] none
ECI2IRU_Q[2] none
ECI2IRU_Q[3] none
RWA[0].Rpm rpm
RWA[1].Rpm rpm
RWA[2].Rpm rpm
RWA[3].Rpm rpm
ANAV_Eclipsed flag
1 1 0 3 8.54E-08 2.59E-08 -5.98E-08 1 1.295752618 1.2989038 5.495479291 -9.591810973 0
2 1 0 3 1.89E-06 5.20E-08 1.07E-06 1 5.612838988 5.626486779 23.80152215 -41.80307628 0
3 1 0 3 5.36E-06 1.96E-07 9.96E-06 1 9.926691625 9.950824754 42.08872415 -74.01484423 0
4 1 0 3 9.08E-05 4.12E-07 8.60E-06 1 14.2371683 14.27177551 60.35674405 -106.1841529 0
5 1 0 5 1.54E-05 7.62E-07 1.50E-05 1 18.54407687 18.58914691 78.62846211 -138.3115435 0
6 1 0 5 2.69E-05 2.27E-06 6.30E-05 0.999999999 22.84718311 22.90270475 96.88993192 -170.3976624 0
7 1 0 5 2.94E-05 1.70E-06 3.28E-05 0.999999999 27.1611309 27.21218229 115.1304895 -202.4432368 0
8 1 0 5 6.29E-05 2.29E-06 6.43E-05 0.999999998 31.472361 39.51729109 133.3494285 -234.4490483 0
9 1 0 5 7.82E-05 2.80E-06 5.74E-05 0.999999996 38.77891735 35.81773271 151.5460174 -269.4159032 0
And all I need from this file is the first column and the fifth through the eigth column. Then I want to take this data and put it into a file that looks like this:
stk.v.4.2
BEGIN Attitude
NumberofAttitudePoints 9
ScenarioEpoch 1 Sep 2007 12:00:00.00
AttitudeTimeQuaternions
1 8.54E-08 2.59E-08 -5.98E-08 1
2 1.89E-06 5.20E-08 1.07E-06 1
3 5.36E-06 1.96E-07 9.96E-06 1
4 9.08E-05 4.12E-07 8.60E-06 1
5 1.54E-05 7.62E-07 1.50E-05 1
6 2.69E-05 2.27E-06 6.30E-05 0.999999999
7 2.94E-05 1.70E-06 3.28E-05 0.999999999
8 6.29E-05 2.29E-06 6.43E-05 0.999999998
9 7.82E-05 2.80E-06 5.74E-05 0.999999996
Where the "NumberofAttitudePoints" must display the number of rows of data copied over (9). If anyone has any input I would really appreciate it, I've been having trouble finding help on this probably because it is such a basic task. Thanks