combining files and testing results

Patrick O'Callaghan pocallaghan at gmail.com
Tue May 14 17:01:42 UTC 2013


On Tue, 2013-05-14 at 09:56 +0100, Frank Murphy wrote:
> Having looked at "man join" wasn't sure of it's use here.

'join' is more like a database table join (think of two tables being
joined horizontally).

> Unknown number of files, constant is extension .list
> (For testing purposes only using two)
> 
> cat *.list >> output.joined | sort -u

That's almost certainly not what you want:

1) You probably want '>' rather than '>>' if you're only running this
once. Not that it makes a difference here but it's superfluous.

2) Since you're sending the output of 'cat' to a file, the pipe won't
get any input, so you're you sorting nothing. If you actually want to
capture the output in a file, you can use 'tee':

        sort *.list | tee output | sort -u

or just run the two commands separately:

        cat *.list > output
        sort -u < output
        
If not, then "cat *.list|sort -u" is enough.

poc



More information about the users mailing list