Here are my attempts to replace a b
character with a newline using sed
while running bash
$> echo \'abc\' | sed \'s
$ echo 'abc' | sed 's/b/\'$'\n''/'
a
c
In Bash, $'\n'
expands to a single quoted newline character (see "QUOTING" section of man bash
). The three strings are concatenated before being passed into sed as an argument. Sed requires that the newline character be escaped, hence the first backslash in the code I pasted.