N Append the next line of input to
the pattern space with an embed-
ded new-line. (The current line
number changes.) If no next
line of input is available, the
N command verb shall branch to
the end of the script and quit
without starting a new cycle and
without writing the pattern
space.
!command | Don't. Apply the command (or|
| group, if command is {) only to|
| lines not selected by the|
| address(es). |
$ Last line
Having said that.....
'$!N' translates into except for the last line append the Next line to the pattern space with the embedded newline.
Having the 'embedded new line' in the pattern space, next command [s/\\n/$\(/bin/echo '\\t'\)] substitutes new line '\n' with a TAB character. The tab character is produced by active function using 'echo' - '$(/bin/echo .....)'.