awk to process the first two lines then the next two and so on

Suppose i have a very file which i created from two files one is old & another is the updated file by using cat & sort on the primary key.

File1

102310863||7097881||6845193||271640||06007709532577||||
102310863||7097881||6845123||271640||06007709532577||||
102310875||7092992||6840808||023740||10034500635650||||
102310875||7092992||6840818||023740||10034500635650||||

So pattern of this file is line 1 = old value & line 2 = updated value & so on..

now I want to process the file in such a way that awk first process the first two lines of the file & find out the difference & then move on two the next two lines.

now the process is

if($[old record]!=$[new record])
    i= [new record]#[old record];

Desired output

102310863||7097881||6845123#6845193||271640||06007709532577||||
102310875||7092992||6840818#6840808||023740||10034500635650||||


Source: bash

Leave a Reply