in unix, is it better to sort multiple small files, or one big file?
So I have multiple files that I am working on and they need to be combined and sorted. Would it be more efficient to sort each file first and use the sort -m option when combining the files, or to combine them first and then sort.
Or is it the same? My understanding is that unix uses merge sort so in essence, would the one b开发者_高级运维ig file be separated, sorted, and recombined anyway? So it shouldn't make a difference?
Sort the files together.
sort file1 file2 file3 file4
Unless you have a lot of time to investigate, the sort command will do a better job than you in breaking the files into appropriately-sized chunks, sort them independently and recombine them.
精彩评论