What is Nostr?
Tim Chase /
npub1n50…cr3d
2024-12-20 14:06:53

Tim Chase on Nostr: You might be familiar with sed '/pattern/G' for inserting a blank line *below* lines ...

You might be familiar with

sed '/pattern/G'

for inserting a blank line *below* lines matching /pattern/ but sometimes you want to put the blank line *above* the matching line. For that, you can use

sed '/pattern/{x;p;x;}'

It swaps the current space with the (empty) hold-space, prints that blank-line, then swaps them back so the matching line is there to be printed at the end of the cycle.
Author Public Key
npub1n507nu5u0g0yy3jv8xzlwxzluyft9ps5p5etskrd6dxxlykkm8hqtucr3d