Reputation
1,357
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
1 9 17
Impact
~214k people reached

  • 0 posts edited
  • 0 helpful flags
  • 98 votes cast
1d
comment Wrap and indent text using coreutils
@ThomasDickey That’s why I’m mentioning it in the comments now. It is mentioned in the link which I referred to when discussing sed. I had assumed you had read that since you were confident that sed wasn’t needed.
1d
comment Wrap and indent text using coreutils
@ThomasDickey Replacing sed by awk is of course possible but (a) I need to have two separate commands because I sort the entries in-between parsing and formatting, and POSIX awk doesn’t have built-in sort (gawk does); and (b) simply extracting the documentation seems simpler in sed than awk.
1d
accepted Wrap and indent text using coreutils
1d
comment Wrap and indent text using coreutils
Ah hm. I was precisely trying to avoid that and use a pre-baked solution instead to handle edge cases properly: for instance, the above doesn’t handle dashes nicely — but, it turns out, neither does fold. So I’ll go with this.
Apr
30
comment Wrap and indent text using coreutils
This is almost perfect. The only problem is that the lower bound — 50 — is arbitrary and will break if the input contains a word with more than 10 characters at the crucial position. Any suggestion for how to fix this? Using a lower number won’t work because then the match seems to happen non-greedily (actually I’m not sure what’s happening because it’s not simply matching single words).
Apr
30
comment Wrap and indent text using coreutils
@ThomasDickey Can awk easily wrap lines at whitespace? the regular expression and text manipulation tools of awk are rather primitive … short of manually implementing the word-wrapping inside a (nested) loop.
Apr
30
asked Wrap and indent text using coreutils
Apr
12
awarded  Famous Question
Feb
3
awarded  Good Question
Jan
13
awarded  Yearling
Nov
8
awarded  Nice Answer
Apr
24
awarded  Notable Question
Jan
21
comment Write all tmux scrollback to a file
This is problematic at best … pasting into insert mode in Vim has all kinds of problems, e.g. when you have automatic indentation enabled. I never got this to work to my satisfaction.
Jan
13
awarded  Yearling
Dec
9
awarded  Popular Question
Dec
5
awarded  Curious
Dec
4
accepted Use paste with row-major input
Dec
4
comment Use paste with row-major input
This works, but I think by “line length” you mean “number of lines/rows”.
Dec
4
comment Shebang line with `#!/usr/bin/env command --argument` fails on Linux
Specification fail. My god.
Dec
4
asked Use paste with row-major input