bash replace spaces with a comma May 9, 2023 • ulysses Replace spaces with commas from one file and send the output to another file. tr -s '[:blank:]' ', ' output.txt It’s perfect for creating a comma delimited file for importing to Excel.