I have a data file named File-1, FirstFile-1. I havetohave to match a pattern "DATA_POINTS"DATA_POINTS, and then after skipping two rows/linesone line I want to print 6th column of the following lines.
File-1
here ! some other data exist but all of them are totally different from the below data!
In simple words following data is completely unique.
DATA_POINTS
12
0.0000000000 0.0000000000 0.0000000000 20 ! A
0.5000000000 0.5000000000 0.0000000000 20 ! B
0.7500000000 0.5000000000 0.2500000000 20 ! C
0.7500000000 0.3750000000 0.3750000000 20 ! D
0.0000000000 0.0000000000 0.0000000000 20 ! E
0.5000000000 0.5000000000 0.5000000000 20 ! F
0.6250000000 0.6250000000 0.2500000000 20 ! U
0.7500000000 0.5000000000 0.2500000000 20 ! W
0.5000000000 0.5000000000 0.5000000000 20 ! L
0.7500000000 0.3750000000 0.3750000000 20 ! K
0.6250000000 0.6250000000 0.2500000000 20 ! U
0.5000000000 0.5000000000 0.0000000000 20 ! X
Output
File-1example:here ! some other data exist but all of them are totally different from the below data! In simple words following data is completely unique. DATA_POINTS 12 0.0000000000 0.0000000000 0.0000000000 20 ! A 0.5000000000 0.5000000000 0.0000000000 20 ! B 0.7500000000 0.5000000000 0.2500000000 20 ! C 0.7500000000 0.3750000000 0.3750000000 20 ! D 0.0000000000 0.0000000000 0.0000000000 20 ! E 0.5000000000 0.5000000000 0.5000000000 20 ! F 0.6250000000 0.6250000000 0.2500000000 20 ! U 0.7500000000 0.5000000000 0.2500000000 20 ! W 0.5000000000 0.5000000000 0.5000000000 20 ! L 0.7500000000 0.3750000000 0.3750000000 20 ! K 0.6250000000 0.6250000000 0.2500000000 20 ! U 0.5000000000 0.5000000000 0.0000000000 20 ! X- Desired output
S1 = A S2 = B S3 = C S4 = D S5 = E S6 = F S7 = U S8 = W S9 = L S10= K S11= U S12= X
S1 = A
S2 = B
S3 = C
S4 = D
S5 = E
S6 = F
S7 = U
S8 = W
S9 = L
S10= K
S11= U
S12= X
The pattern DATA_POINTS does not repeat in the file, and an exact match is desired.
Nearest Solution
Nearest Solution
awk '/DATA_POINTS/{i==0 ; i++; getline; print "S"i"=", $6}' file
File-1
Thanks in advance! I really Appreciate the help!!