Skip to main content
Improve accuracy of title--question is specific to filepaths.
Link
jubilatious1
  • 3.9k
  • 10
  • 20

Replace space between filepaths with new linenewline

Question Protected by dr_
edited tags; edited title
Link
Braiam
  • 36.9k
  • 29
  • 114
  • 176

bash - replace Replace space with new line

replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

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?How can I find and replace with a 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?

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?

edited tags
Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k
Loading
edited body
Source Link
Raphael Ahrens
  • 9.9k
  • 5
  • 39
  • 53
Loading
Source Link
laconbass
  • 4.5k
  • 4
  • 19
  • 20
Loading