uniq: group similar lines (original) (raw)


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


From: Jérémy Compostella
Subject: uniq: group similar lines
Date: Mon, 12 Mar 2012 23:42:13 +0100

All,

I'm interested to work on the uniq --group feature as described in the following thread: http://lists.gnu.org/archive/html/coreutils/2011-03/msg00000.html

$ printf "1 a\n2 a\n2 b\n3 a\n3 b\n4 a\n" | uniq -w1 --group 1 a

2 a 2 b

3 a 3 b

4 a

With this new option, uniq becomes very useful to easily separate block of similar lines in a file. --group would be an addition to modify the default behavior : instead of suppress similar lines, separate block of similar lines.

I do not agree with the proposition of using the --group option in conjunction with the -u option or with the -D option for the following reasons:

  1. -D, --all-repeated already has the appropriate argument : "separate".
  2. -u, --unique could be enhance with the same kind of arguments than --all-repeated.
  3. Above all, IMHO, --group option would be an addition to provide a new behavior and not a new way to access an already existing behavior.

Maybe, we could consider the --unique=[delimit-method] addition too although it seems less interesting and I do not see any use case.

What do you think ?

Cheers,

Jérémy

Sent from my Emacs



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