merge two files
Hi Guys,
Im trying to create a backup mailserver for some cpanel servers. This involves a file on backup server (/etc/secondarymx) containing the contents of a file (/etc/localdomains) from each other server wishing to use it. I can copy the "localdomains" file over to the backup server which is fine but how do I merge the file contents to the "secondarymx" file without creating duplicate data. The files are just domain lists with line breaks i.e. domain1 domain2 domain3... Thanks, Paul |
# cat localdomains >> secondarymx
|
Quote:
|
after appending do a "sort -u" on the file to remove dups
|
Quote:
Thanks for your help :) I ran "sort -u data3" data3 being the final output file, it sorts it on the screen however does not write this to the file so data3 remains with duplicates. :confused: |
ofcourse u will have to redirect the output of sort to another file and then overwrite the original with the new one.
sort -u secondarymx > secondarymx.tmp mv secondarymx.tmp secondarymx |
Quote:
|
All times are GMT -5. The time now is 05:12 PM. |