Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for comma

February 4, 2020

Replace spaces with comma

Here’s a simple sed command to replace multiple spaces into a comma delimited file.

sample.txt

one       two
three     four

one two three four

The sed command.

sed 's/ \+ /,/g' sample.txt > sample2.txt

sed 's/ \+ /,/g' sample.txt > sample2.txt

sample2.txt

one,two
three,four

one,two three,four

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021