Padding diff result

Hi,

Is there a way to add padding to a diff result in unix so number of "< .." lines will be equal to number of "> .." lines?
For example, if the original result is:

9a10
> "line which exists only in one file"

The changed result would be:

9a10
< "noMatch"
---
> "line which exists only in one file"

Thanks

And if you wrote code to do that what would you do with the output? (What I'm asking is: what are your trying to acheive? --the answer is not "padding diff output")

Maybe

diff -y 

is what you want, to give you some sort of answer.

Hi jim,
I have two columns in each file, and I'd like to combine them like this:

file 1:

green 3
red 2
blue 1

file 2:

green 5
blue 6

output:

green 3 5
red 2 -
blue 1 6

And I already wrote a code which can solve the problem if "file 2" has an a dummy line

Thanks

That sort of thing is best doable with awk (perl) using associative (hash) arrays...

OK thanks =)

Hi.

I would use join:

$ join -o 0,1.2,2.2 -a 1 -e - <( sort z1) <(sort z2)
blue 1 6
green 3 5
red 2 -

Using these versions:

bash GNU bash 3.2.39
sort (GNU coreutils) 6.10
join (GNU coreutils) 6.10

See man pages for details.

Best wishes ... cheers, drl