wiki.diff 525 B

123456789101112131415161718192021222324252627
  1. #!/bin/rc
  2. rfork n
  3. cd $1
  4. *=(`{ls -drp [0-9]*})
  5. while(! ~ $#* 0 1){
  6. diff -n $2/index.txt $1/index.txt | awk -F'[\/ :]' '
  7. $1 ~/^[0-9]+$/ {
  8. getA = "cat "$5"/current | sed -n -e ''1d; /^A/s/^A//p; /^#/q''"
  9. getA | getline A; close getA
  10. $1 = t2d($1)
  11. $5 = t2d($5)
  12. print "\n" A ":\n" $1":"$3" "$4" "$5":"$7
  13. next
  14. }
  15. { print }
  16. function t2d(t) {
  17. c = "date "t; c|getline l; close c
  18. split(l, a, "[ :]+")
  19. return a[1]" "a[2]" "a[3]" "a[4]":"a[5]" "a[8]"("t")"
  20. }'
  21. shift
  22. }
  23. echo clean >/dev/ctl >[2]/dev/null