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.

2
  • sed would be a poor choice of tool for doing this. See mikefarah.gitbook.io/yq for how to install/use a yaml editor and if you can't install yq for some reason then you'd use awk. Commented Aug 25, 2020 at 20:31
  • Change the N in your sed code to $!N. The lonely N is causing the last line to not be printed. Take care to backslash it since you are inside double quotes. For a robust way lookat my solution using python. I like your approach of combining N with range. Commented Aug 26, 2020 at 4:30