- 论坛徽章:
- 71
|
回复 3# wh7211
$ awk '{a[$1][$2]++;b[$1]=b[$1]>$2?b[$1] 2}END{for(i in a){for(j=1;j<=b;j++){if(!a[j]){c=c?c:j;c=c<j?c:j;d=d>j?d:j}else{if(c&&c==d){e=e?e","c:c;c=j+1}else if(c&&c!=d){e=e?e","c"-"d:c"-"d;c=j+1}}};print i,e;c=d=e=""}}' a.txt
awk: {a[$1][$2]++;b[$1]=b[$1]>$2?b[$1] 2}END{for(i in a){for(j=1;j<=b;j++){if(!a[j]){c=c?c:j;c=c<j?c:j;d=d>j?d:j}else{if(c&&c==d){e=e?e","c:c;c=j+1}else if(c&&c!=d){e=e?e","c"-"d:c"-"d;c=j+1}}};print i,e;c=d=e=""}}
awk: ^ syntax error
awk: {a[$1][$2]++;b[$1]=b[$1]>$2?b[$1] 2}END{for(i in a){for(j=1;j<=b;j++){if(!a[j]){c=c?c:j;c=c<j?c:j;d=d>j?d:j}else{if(c&&c==d){e=e?e","c:c;c=j+1}else if(c&&c!=d){e=e?e","c"-"d:c"-"d;c=j+1}}};print i,e;c=d=e=""}}
awk: ^ syntax error
awk: {a[$1][$2]++;b[$1]=b[$1]>$2?b[$1] 2}END{for(i in a){for(j=1;j<=b;j++){if(!a[j]){c=c?c:j;c=c<j?c:j;d=d>j?d:j}else{if(c&&c==d){e=e?e","c:c;c=j+1}else if(c&&c!=d){e=e?e","c"-"d:c"-"d;c=j+1}}};print i,e;c=d=e=""}}
awk: ^ syntax error
|
|