How to put file into clipboard without losing control characters?

Solution 1:

pbcopy will take input piped or redirected into it, and store it in a "pasteboard" (i.e. clipboard). So to copy a file verbatim, use a redirection:

pbcopy < dosfile

To paste, use Commandv or

pbpaste | some_command
pbpaste > some_file