Skip to main content
2 of 6
edited body
Raphael Ahrens
  • 9.9k
  • 5
  • 39
  • 53

bash - replace space with new line

How can I replace spaces with new lines on an input like:

/path/to/file /path/to/file2 /path/to/file3 /path/to/file4 /path/to/file5 etc...

To obtain the following:

/path/to/file
/path/to/file2
/path/to/file3
/path/to/file4
/path/to/file5

Note

I'm posting this question to help other users, it was not easy to find a useful answer on UNIX SE until I started to type this question. After that I found the following:

Related question

How can I find and replace with a new line?

laconbass
  • 4.5k
  • 4
  • 19
  • 20