Do you have a "Gene" name or similar column that are identical between both data sets? If so then the merge() function in R could do this fairly easily.
Something like this should work fairly well (ignore the .cdt file extensions, this will work for most tab delimited data sets).
# Set your working directory.
setwd("~/workspace/GenomicsData/analysis/visualization/homerheatmaps/")
# Read in your files (cdt's are tab-delimited). File1 should be your sorted cdt file.
# File2 should be the cdt file you want to sort.
file1 <- read.delim("groseqheatmap_sorted.cdt")
file2 <- read.delim("hexim_heatmap.cdt")
# Merge the files together into a seperate file called file3 for easy write-out.
# Here we are sorting by gene, but any column name is appopriate (as well as number).
file3 <- merge(file1["Gene"], file2, by="Gene", sort=FALSE)
# Write out file3 for easy altering in text editor.
# file = "whatever_you_want_to_name_your_output_file"
write.table(x = file3, file = "hexim_sortedtogroseq.cdt", sep = "\t", quote = FALSE, row.names = FALSE)