summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/join/join.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/join/join.c b/usr.bin/join/join.c
index 74f7dc7..63dccb7 100644
--- a/usr.bin/join/join.c
+++ b/usr.bin/join/join.c
@@ -469,9 +469,15 @@ outoneline(INPUT *F, LINE *lp)
else
outfield(lp, 0, 1);
}
- else
+ else {
+ /*
+ * Output the join field, then the remaining fields.
+ */
+ outfield(lp, F->joinf, 0);
for (cnt = 0; cnt < lp->fieldcnt; ++cnt)
- outfield(lp, cnt, 0);
+ if (F->joinf != cnt)
+ outfield(lp, cnt, 0);
+ }
(void)printf("\n");
if (ferror(stdout))
err(1, "stdout");
OpenPOWER on IntegriCloud