[Discuss] join question

pw p.willis at telus.net
Thu Oct 11 14:29:18 PDT 2007


Hello,

I am joining some files in bash and getting some unexpected
behavior from the 'join' command. I am working with cygwin
so I can script text files for use with some windows utilities
since bash, in most respects, is much better for this than DOS.
(until now)

My files only have one column each so at the surface
one would think the following would work:

join -t "|" file_a file_b

In this case I am using the '|' character as a delimiter.
Join does nothing...

I am then thinking that rows may require at least one
delimiter for join to work. In that vein I add a delimiter
to the end of each row and run the command again.
Join does nothing...

Then I think join may need a delimiter on either side of
any single column. To that end I reformat my input data
to have a '|' character both before and after the data on
each row. I run the command once again.
Join suddenly springs to life, joining like crazy.
The only problem is I get all the lines in file_b joined to
each line in file_a. Thus file_b is repeated file_a.numlines
times...

The command worked fine for files with more than
one column of data.

Am I missing a flag?
Is bash broken on cygwin?
Does the join command work?

Anyone have any ideas?

Peter



More information about the Discuss mailing list