[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug #24974] Document that comm's option "-1", "-2" and "-3" can be
Frank Lin PIAT
Re: [bug #24974] Document that comm's option "-1", "-2" and "-3" can be combined
Mon, 01 Dec 2008 20:44:45 +0100
On Mon, 2008-12-01 at 00:25 +0000, Pádraig Brady wrote:
> anonymous wrote:
> > URL:
> > <http://savannah.gnu.org/bugs/?24974>
> > Hello,
> > Could you explicitly document that "-1", "-2" and "-3" options
> > of "comm" can be combined.
> > This isn't obvious, and may lead some people [me!] to use
> > other tools instead.
> It's common for options to be combined unless otherwise stated,
> but I take your point that it's perhaps a little confusing.
> Perhaps this change would make it more obvious?
> It's not removing info as the info removed is already
> presented on the previous line.
> diff --git a/src/comm.c b/src/comm.c
> - -1 suppress lines unique to FILE1\n\
> + -1 suppress output of column 1\n\
Actually, I think both information are useful... Maybe something like:
"suppress lines unique to FILE1 (suppress output of column 1)"
but that's 79 character long... not really nice.
"suppress lines unique to FILE1 (i.e don't output column 1)"
> I might add some examples to the docs also, along the lines
> of the following if I get a second. At least I should get
> the docs for `comm` and `join` to reference each other.
Yes, I love examples in manpages.
> # set operations on sorted files
Maybe just focus on what each command does very well.
> comm file1 file2 | sed 's/^\t*//' #Union
> comm -12 file1 file2 #Intersection
> comm -13 file1 file2 #Difference
> comm -3 file1 file2 | sed 's/^\t*//' #Symmetric Difference
"Print lines present in both file1 and file2 (Intersection)."
comm -12 file1 file2
"Print lines not in the other file, both way (Symmetric Difference)"
comm -3 file1 file2 | sed 's/^\t*//'
> join -a1 -a2 file1 file2 #Union
> join file1 file2 #Intersection
> join -v2 file1 file2 #Difference
> join -v1 -v2 file1 file2 #Symmetric Difference
> # set operations on unsorted files
> sort file1 file2 | uniq #Union
> sort file1 file2 | uniq -d #Intersection
> sort file1 file1 file2 | uniq -u #Difference
> sort file1 file2 | uniq -u #Symmetric Difference
Note: This only works if the input files don't contain duplicated lines.
"Print lines in file2 not present in file1 (Difference / Substraction):"
grep -Fv -f file1 file2
"Print all distinct lines in file1 or file2 (Union):"
sort -u file1 file 2
> p.s. Those new --check-order --nocheck-order options confuse me.
> When they were added I only took a quick look at the implementation
> rather than the interface (which Bo Borgerson kindly sped up for us).
> Perhaps something like this would be clearer:
That feature is great.
Actually, it's worth emphasizing that files should be sorted in the
manpage: the sentence "Compare sorted files FILE1 and FILE2 line by
line." is quite clear... for those who read it carefully. may be :
"Compare two files FILE1 and FILE2 line by line. Each file must be
|[Prev in Thread]
||[Next in Thread]|
- Re: [bug #24974] Document that comm's option "-1", "-2" and "-3" can be combined,
Frank Lin PIAT <=