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*

8
  • 2
    Fail on multibyte characters. Try echo "abcdeéèfg" | fold -1 | paste -sd\& - Commented Aug 25, 2017 at 3:00
  • 3
    @Arrow Most probably you are just using a buggy coreutils version of fold, which does not have a full Unicode support. BSD fold, RedHat-patched versions of coreutils (i.e. Fedora or CentOS) as well as BusyBox implementation of it, can handle Unicode just nice. Commented Aug 25, 2017 at 6:31
  • 5
    The question is specifically about sed. Commented Aug 25, 2017 at 8:11
  • 6
    @Alexander - that is true, and there is a number of good sed answers available below. And I don't see any harm in demonstrating how the task can be solved by the other means. Commented Aug 25, 2017 at 8:39
  • @StéphaneChazelas >POSIXly, you'd need fold -w 1 True, I've added "-w", thx ! "-", in turn, is not required If no file operands are specified, the standard input shall be used Commented Aug 25, 2017 at 8:55