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
  • 1
    @DisplayName: for string abcde without using perl, use yes: yes "abcde" | tr -d '\n' ... Commented Apr 20, 2021 at 12:08
  • @OlivierDulac, d'oh, I've really been slow here. Using yes actually crossed my mind before, but I got stuck at the mandatory newline... yes $'\xff' | tr -d '\n' | ... would also work for the all-ones in shells that support $''. Commented Apr 20, 2021 at 12:18
  • I'd certainly not qualify you as slow ^^. And having different options (suxh as perl) is always welcomed. Feel free to add the yes variant as well if you want. Commented Apr 20, 2021 at 12:24
  • It's (very) slightly more efficient to head or dd first in the pipe, then tr after. Commented Apr 21, 2021 at 12:18