Do you mean something like this? In this case, I made @
active to denote the end of the verbatim each line, so that it could both detect prior spaces, as well as typeset a <cr>
to signify the end of line. (See ADDENDUM for update)
\documentclass{article}
\usepackage{verbatimbox}
\def\rlwd{.5pt}
\begin{document}
\catcode`@=\active
\def@{<cr>}
\def\tmp{\setbox2=\hbox{0}%
\def\ {\makebox[\wd2]{\rule{\rlwd}{2pt}\rule{3pt}{\rlwd}\rule{\rlwd}{2pt}}}%
}
\begin{verbnobox}[\tmp]
This is a test @
more test @
The end@
\end{verbnobox}
\catcode`@=12
\end{document}

If one did not like the confusion of having the <cr>
in the same font as the verbatim
, one could alter it thus:
\documentclass{article}
\usepackage{verbatimbox,xcolor}
\def\rlwd{.5pt}
\begin{document}
\catcode`@=\active
\def@{\textcolor{red}{{\tiny\rmfamily\bfseries$<$cr$>$}}}
\def\tmp{\setbox2=\hbox{0}%
\def\ {\makebox[\wd2]{\rule{\rlwd}{2pt}\rule{3pt}{\rlwd}\rule{\rlwd}{2pt}}}%
}
\begin{verbnobox}[\tmp]
This is a test @
more test @
The end@
\end{verbnobox}
\catcode`@=12
\end{document}

ADDENDUM
Since this answer was originally provided I have learned that verbatim
environment and even the \verb
macro have star variants (e.g., verbatim*
) which provide the visible space glyph. Thus, no extra packages are actually needed.
\documentclass{article}
\begin{document}
\catcode`@=\active
\def@{<cr>}
\begin{verbatim*}
This is a test @
more test @
The end@
\end{verbatim*}
\catcode`@=12
\end{document}

verbatim*
environment does spaces (but not by default end of line) although could easily be added – David Carlisle Jun 3 '14 at 13:07a2ps
*nix utility. As far as I remember it is configurable to fulfill your needs. – user31729 Jun 3 '14 at 13:45