Hi,
I have two files viz,
rak1:
$ cat rak1
Quote:
#this is test
[section1]
PMAN 2
ZMAN 4
[section2]
xxx 0
NOP 6
[section 3]
PMAN 1
ZMAN 8
|
rak2:
$ cat rak2
Quote:
#this is test
[section1]
PMAN 2
ZMAN 9
[section2]
xxx 0
NOTA 5
TOCN 8
[section 3]
PMAN 1
|
returns:
Quote:
$ sdiff rak1 rak2
#this is test #this is test
[section1] [section1]
PMAN 2 PMAN 2
ZMAN 4 | ZMAN 9
[section2] [section2]
>
xxx 0 xxx 0
NOP 6 | NOTA 5
> TOCN 8
>
>
>
>
>
[section 3] [section 3]
PMAN 1 PMAN 1
ZMAN 8 <
|
I want the lines that got modified, changed, or deleted preceding with the section they are in.
I have done this so far:
Quote:
$ sdiff rak1 rak2 | sed 's/ //g' | grep -n "." | egrep -e "\||<|>" | sed '/>$/d'
5:ZMAN 4 |ZMAN 9
10:NOP 6 |NOTA 5
11:>TOCN 8
20:ZMAN 8 <
|
but I dont know how to put
section in front of the changed,added or deleted lines.
Also it would be appreciated if the output could be printed as
[section X] <valInFile1/valInFile2> <valInFile1/valInFile2>
and so on.
Please Help me out