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.

5
  • 1
    Note that your sed approach will fail if any file names contain newlines. Commented Apr 16, 2021 at 12:45
  • @terdon Yes. But have you ever seen newline in file names in real life? Commented Apr 16, 2021 at 12:58
  • 3
    Yes, of course. Many times. Usually because of a bug somewhere, but not always. More importantly, such files can be trivially created (e.g. touch foo$'\n'bar) so we should make sure we can deal with them. Commented Apr 16, 2021 at 13:00
  • @RalfFriedl, of nothing else, we see them every time we test the answers we write here on the site :D Commented Apr 16, 2021 at 14:06
  • @RalfFriedl, but, a world where such effed-up filenames were not possible would indeed be a nicer one. We just need to convince every Unix-like system to add some limitations. Or at least convince them to read dwheeler.com/essays/fixing-unix-linux-filenames.html Commented Apr 16, 2021 at 14:37