I have data in the following sorted order (Here the data is sorted according to first v1, then v2, then v3 and then v4):
v1=1 v2=8513481 v3=119330184 v4=0
v1=1 v2=8521383 v3=119330182 v4=0
v1=1 v2=10630231 v3=60529116 v4=18
v1=1 v2=60528877 v3=60529221 v4=17
v1=1 v2=90351079 v3=90351078 v4=20
v1=1 v2=271669588 v3=271669683 v4=101
v1=2 v2=8513481 v3=10583646 v4=0
v1=2 v2=10175437 v3=10175436 v4=0
v1=2 v2=10630231 v3=60528947 v4=17
v1=2 v2=10630231 v3=60529119 v4=18
v1=2 v2=10630232 v3=605291191 v4=18
Now I want to find out the rows where v1's and v2's of 2 lines are equal. i.e. amongst the data given above I want to find rows of the following form:
v1=2 v2=10630231 v3=60528947 v4=17
v1=2 v2=10630231 v3=60529119 v4=18
I know how to do so in python by comparing the successive rows and whenever there is a match outputing the row. Is there an easy way to do the same using linux commands like sed, etc. I know how to use sed to find words when two values are given, but I dont know how to use sed in this context. A bit of explanation is highly appreciated.