1
0
mirror of synced 2026-01-12 00:42:56 +00:00
Interlisp.medley/scripts/fixlinks.awk

10 lines
468 B
Awk

BEGIN {hash="0"; gc = 0;}
function processgroup(group, gc) {
printf("# processing group of %d files -- ",gc);
for (i=1; i <= gc; i++) printf("'%s' ",group[i]);
printf("\n");
printf("rm '%s' && ln '%s' '%s'\n", group[gc],group[1], group[gc]);
}
hash == $1 && 1 == index($2, group[1]) {gc = gc + 1; group[gc] = $2; }
hash != $1 || 1 != index($2, group[1]) { if (gc > 1) processgroup(group, gc); delete group; hash = $1; gc = 1; group[gc] = $2;}