I have to print the next line if the previous line matches a condition.
file a.dat
with below contents
1
2
3
1
2
1
if $1 matches 3 then print 1(next line)
. I tried it with below awk statement
awk ' { if($1=="3") { {next} {print $1} } }' a.dat
but it didn't work. When i was looking for it i understood that when awk encounters a next
no further rules are executed for the current record, hence i got an empty result. Is there a way to get around this with next
itself using awk.