1) Please use ***
[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do
not use quote tags, bolding, colors, "start/end" lines, or other creative techniques.
The long, unbroken lines in your post are forcing my screen to side-scroll. Edit it to enclose them, please.
2) Please try doing a search of past threads first. Questions like this tend to come up with good regularity.
In any case, this is a common example of how important it is to understand the shell's quoting behavior and argument parsing.
http://mywiki.wooledge.org/Arguments
http://mywiki.wooledge.org/WordSplitting
http://mywiki.wooledge.org/Quotes
3) You can avoid most of those backslashes if you enable the
-r extended regular expressions option.
Code:
sed -r "s:(.{107})(.{19}):\1$total:" trailerfile
See the section on basic versus extended regex in the sed
info page.