Extract mapping to a file