Sorting two files, then merging

Sorting two files, then merging

Post by Jack Vins » Thu, 29 Oct 1992 00:25:41

I am trying to use "Sort -m" to merge two sorted files.  The obvious way to
do this seems to be:

sort file1 > sorted1
sort file2 > sorted2
sort -m sorted1 sorted2 > merged

And if I need to process file1 first I can do this:
sort file2 > sorted2
process file1 | sort -m - sorted2 > merged

The question is, can I somehow compress all of this into one line? i.e.
process file1 | sort -m - (sort file2) > merged

That doesn't work, though.  Is there something that might?

The Purple Puddle Eater


1. How to merge two columns of numbers from two different files?

Hi there:

        I have two data files which have more than a few columns of numbers.
I want to pick certain column from each file and merge them together into a
third file.  How to do this?  Too bad awk only takes one input file


2. nested groups

3. Can I merge two files into one?

4. Recovering a Partition map

5. Merge of two files

6. Looking for TLI program

7. Need to regularly merge two passwd files

8. ppp 2.2.0f and mschap80

9. ** Merging Two Text Files Parallel **

10. Merging two TXT files

11. How to merge two files with awk

12. Looking for sample code to merge two files.