-6

I have to replace a ]\n with a \t using sed, but I have no idea how to do it. can anybody help me?

agc
  • 7,973
  • 2
  • 29
  • 50
C. van Veen
  • 43
  • 1
  • 11
  • 3
    Please avoid *"Give me the codez"* questions. Instead show the script you are working on and state where the problem is. Also see [How much research effort is expected of Stack Overflow users?](https://meta.stackoverflow.com/q/261592/608639) – jww Sep 09 '18 at 21:34
  • 2
    Why do you "have to" use sed? – melpomene Sep 09 '18 at 21:35
  • Welcome to SO. Stack Overflow is a question and answer site for professional and enthusiast programmers. The goal is that you add some code of your own to your question to show at least the research effort you made to solve this yourself. – Cyrus Sep 09 '18 at 22:16
  • Possible duplicate of [How can I replace a newline (\n) using sed?](https://stackoverflow.com/questions/1251999/how-can-i-replace-a-newline-n-using-sed) – George Vasiliou Sep 10 '18 at 13:18

1 Answers1

0

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
agc
  • 7,973
  • 2
  • 29
  • 50