Package: moreutils
Version: 0.10
Severity: normal
I don't know if this is a bug, or a feature that isn't
documented:
% cd /tmp
# file A has 3 'I's
% for z in I came I saw I conquered ; do echo $z ; done > A
# file B has 1 'I'
% for z in I dream of Jeannie ; do echo $z ; done > B
% combine A and B
I
I
I
Surprising that 'and' wouldn't stop at the first 'I', since 'B' has
only one.
% combine A or B
I
came
I
saw
I
conquered
dream
of
Jeannie
After that I'd half-expected that 'or' might print 4 'I's.
% combine B and A
I
Also surprising. 'and' isn't commutative. The man page
says:
'and' Outputs lines that are common to both files.
...which sounds commutative.
% combine B or A
I
dream
of
Jeannie
came
saw
conquered
And 'or' isn't commutative.
Probably the 'and' algorithm must go like:
1) let F2=list unique words in 2nd File.
2) let N=0
3) get line N of first file.
4) let N=N+1
5) print line N if N is in list F2
6) if not file1 EOF, goto step 3
...and so forth.
All the uses of 'combine' I can think of involve unique lists, so a
pipe to 'sort --unique' would fix any surprises. Is the current
behavior deliberate, and more useful for other tasks?
Hope this helps...
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-1-686
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Versions of packages moreutils depends on:
ii libc6 2.3.6-4 GNU C Library: Shared libraries an
ii perl 5.8.8-3 Larry Wall's Practical Extraction
moreutils recommends no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]