remove duplicates from sorted array back slash and space for space in commands