This is something I have setup recently to combine counts from two servers and place them into one file.
The text files look like
File1
DEALS-2017-03-03.txt 2317
BONDS-2017-03-03.txt 440
DEAL-2017-03-03.txt 30
EXEC-2017-03-03.txt 39
File2
DEALS-2017-03-03.txt 2399
BONDS-2017-03-03.txt 480
DEAL-2017-03-03.txt 50
EXEC-2017-03-03.txt 39
The requirement was the file names just shown once but with both counts, I acheived this by using the paste command, an example is below
paste 01_output.txt 02_output.txt | awk '{print $1,","$2,","$4'} > combined_count.txt
So they paste command takes the two files, then with the awk command I am selecting the 1st and 2nd columns, and also the 4th column, so if you can imagine the two files together it would be
DEALS-2017-03-03.txt 2317 DEALS-2017-03-03.txt 2399
So there are 4 columns, but we don't need the name again, so we omit that and pipe that into another file.
I am always interested in feedback so please feel free to add any comments, or you can mail me here. If you would like to submit a quick tip with full credit and links back to your site then also feel free to contact me.
