The combination of bash and comm on Solaris 10 seems to work:
#!/usr/bin/env bash
# @(#) s1 Demonstrate results from comm.
# ____
# /
# | Infrastructure BEGIN
echo
set -o nounset
debug=":"
debug="echo"
## The shebang using "env" line is designed for portability. For
# higher security, use:
#
# #!/bin/sh -
## Use local command version for the commands in this demonstration.
set +o nounset
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version =o $(_eat $0 $1) comm
set -o nounset
echo
FILE1=data1
echo " Input file $FILE1:"
cat $FILE1
echo
FILE2=data2
echo " Input file $FILE2:"
cat $FILE2
# | Infrastructure END
# \
# ---
echo
echo " Results from processing:"
comm -23 $FILE1 $FILE2
exit 0
Producing
$ ./s1
(Versions displayed with local utility "version")
SunOS 5.10
GNU bash 3.00.16
comm - no version provided for /usr/bin/comm.
Input file data1:
CSCeb69473
CSCsg70355
CSCsj78917
CSCsj85065
CSCsl48743
CSCsl72823
CSCsl77748
Input file data2:
CSCsg39295
CSCsj78917
CSCsj85065
CSCsl72823
CSCsl77748
Results from processing:
CSCeb69473
CSCsg70355
CSCsl48743
The same results were obtained on Linux 2.6.11 (Debian).
I would next look at the data so see if there are extra non-printing characters ... cheers, drl
I have had problems when sort obeyed my locale but comm did not, or they were used in different locales. Make sure they agree on the sort order. A good safety measure is to use an explicit locale when using commands which care about collation order.
I don't think I have noticed that problem, but it sounds like a good idea. Rather than specify it individually for each command, I'll use the set, export, and report LC_ALL in my demonstration script templates, at least for a while.
The general problem seems like it would often be masked in threads in the forum because copy / paste will not transfer non-printing characters ... cheers, drl