I have a long log-file (ASCII text), which contains lines with different lengths going from some characters to many thousands characters. How can I shorten each long line with bash/linux commands?
Is it possible to replace the cutted text with something like "... N characters removed ..."?

My goal is to keep all lines with a length up to 100 characters untouched.
For all lines > 100 characters keep 40 characters from beginning, 40 characters from end, and insert "... N characters removed ..." in the middle where characters has been cut out (N replaced with number of removed characters).

Is this too complicated to do it with bash/linux commands?
Any help would be appreciated.