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*

10
  • 1
    Please add the expected input and output, and what you tried. Commented Aug 29, 2024 at 7:10
  • 2
    Is there an issue with the pipe that you need to solve? If not, then making the command more complicated does not sound like an improvement. Commented Aug 29, 2024 at 7:11
  • 1
    Note that using \n in the replacement regex is not portable. Using a backslash followed by a newline should work in most implementations of sed, since it is defined by POSIX. Commented Aug 29, 2024 at 7:20
  • 1
    The s/,/\n/g can also be replaced by the (portable) y/,/\n/. Commented Aug 29, 2024 at 7:36
  • 1
    @Vilinkameni In this case, the initial sed could be replaced by tr , '\n'. However, I have a hunch that why they want to change commas into newlines might be to process CSV fields (which means they should be using other tools entierly), but that's just my mind reading neurons flashing randomly. Commented Aug 29, 2024 at 7:42