uniq: dont use count format if empty

This commit is contained in:
Hiltjo Posthuma 2015-03-07 14:04:04 +01:00
parent 695940d50c
commit b2e73936bf

1
uniq.c
View File

@ -49,6 +49,7 @@ uniqline(FILE *ofp, char *l)
if (prevline) { if (prevline) {
if ((prevlinecount == 1 && !dflag) || if ((prevlinecount == 1 && !dflag) ||
(prevlinecount != 1 && !uflag)) { (prevlinecount != 1 && !uflag)) {
if (*countfmt)
fprintf(ofp, countfmt, prevlinecount); fprintf(ofp, countfmt, prevlinecount);
fputs(prevline, ofp); fputs(prevline, ofp);
} }