Is it possible to replace a newline AND another character with a single tab using sed?

Unfortunately the virtual machine that is sed works a certain way, and the way that it works doesn’t make it easy to:

Still, it can be done:

printf 'foo]\nbar\n' | sed ':a;N;$!ba;s/\]\n/ \'$'\t/g'

Output:

foo     bar

Leave a Comment