Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 2
    question with +922 total votes: How do I split a string on a delimiter in Bash? Commented Jun 17, 2016 at 14:57
  • ls /path/to/ | xargs echo | sed 's/\s\+/\n/g' Commented Sep 26, 2018 at 8:40
  • 2
    What produces that text, and what do you want to use it for? If it's a list of actual pathnames, just replacing spaces by newlines may obviously mangle pathnames that contain embedded spaces, such as /User/myself/VirtualBox VMs/. Commented Feb 14, 2021 at 22:33
  • 1
    @Kusalananda Gilles has written an excelent answer here (see unix.stackexchange.com/a/105655/49721) explaining why "A space-separated list of file names doesn't really work: what if one of the file names contained spaces?" Commented Feb 15, 2021 at 9:47