Sunday, August 4, 2019

AWK print next line of match between matches

Let's presume I have file test.txt with following data:



.0

41
0.0
42
0.0
43
0.0
44
0.0
45
0.0

46
0.0
START
90
34
17
34
10
100
20

2056
30
0.0
10
53
20
2345
30
0.0
10

45
20
875
30
0.0
END
0.0
48
0.0
49

0.0
140
0.0


With AWK how would I print the lines after 10 and 20 between START and END.
So the output would be.



100
2056

53
2345
45
875


I was able to get the lines with 10 and 20 with



awk '/START/,/END/ {if($0==10 || $0==20) print $0}' test.txt 



but how would I get the next lines?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...