bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

uniq - tab delimited output (feature req)


From: Patrick Tufts
Subject: uniq - tab delimited output (feature req)
Date: Wed, 11 Oct 2006 16:13:10 -0700
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

My apologies if this email address is for bugs only. This is a feature
request (but I feel that the lack of the feature approaches bug status).

Request:

uniq should have an option so it create tab delimited output instead of
space delimited.

Rationale:

The coreutils are often piped together. In the following example,
foo.txt is a tab delimited file:

cut -f 1,2 foo.txt | sort -k 2,2 | uniq -c > bar.txt

A subsequent sort or join operation on bar.txt may not pick up on fields
correctly, if the fields in foo.txt contain spaces. I can specify the
field separator for sort or join to remove the ambiguity, but this only
works if the delimiter is consistent. uniq -c introduces an
inconsistency because it creates space delimted output. This is an
inconsistency unique to uniq -c among the coreutils. No other coreutil
that I've used, including uniq without the "-c", have this behavior.

This special case behavior often trips me up, and I suspect it does so
for other users as well. I find myself writing shims to turn uniq -c
output into tab delimited output just to make uniq work with other
coreutils (sort, join, cut).

It seems that this would be better handled if uniq had a flag to specify
the column separator on a uniq -c

Perhaps something like sort's -t flag, except used to specify the output
seperator.

--Pat





reply via email to

[Prev in Thread] Current Thread [Next in Thread]