Hi,
I am having to dig through some data files comparing similar results,
I really need a side-by-side compare.
I believe adiff does this for acme, but I am not an acme-ista so I thought
"How hand can it be?".
I wrote the script below, but then I thought "I should be able to do this
without temporary files"
This is where my knowledge of rc(1) fails. How to create two pipes, hold
them open, and use them to shuffle bytes.
anyone care to take up the challange?
-Steve
--------------------------------
#!/bin/rc
tmp1=/tmp/diffsbs-1.$pid
tmp2=/tmp/diffsbs-2.$pid
fn sigint { rm -f $tmp1 $tmp2 }
fn sighup { rm -f $tmp1 $tmp2 }
if(! ~ $#* 2){
echo usage: $0 file1 file2
exit 'usage'
}
diff -b -a $1 $2 | awk -v 'out1='^$tmp1 -v 'out2='^$tmp2 '
{
key = substr($0, 1, 1);
txt = substr($0, 2, length($0)-2);
if(key == " "){
printf("%-32.32s\n", txt) > out1
printf("%-32.32s\n", txt) > out2
}
if(key == "-"){
printf("%-32.32s\n", txt) > out1
printf("%-32.32s\n", "") > out2
}
if(key == "+"){
printf("%-32.32s\n", "") > out1
printf("%-32.32s\n", txt) > out2
}
}'
pr -m -o0 -t -w100 -l0 $tmp1 $tmp2