Your analysis sounds correct to me. I would use cat
to join files, since that's its primary function. Just do so without the -v
switch, or any switches for that matter.
Using cat -v ..
on the file has essentially trashed it. Did you try and open it in an image viewer? I tried your method and that's exactly what happened to mine.
You can see the evidence of this using the file
command too:
$ file copy*
copy1.png: PNG image data, 1440 x 847, 8-bit/color RGB, non-interlaced
copy2.png: ASCII text, with very long lines
cat
's info page sheds a bit more light on the subject:
'-v'
'--show-nonprinting'
Display control characters except for LFD and TAB using '^'
notation and precede characters that have the high bit set with
'M-'.
On systems like MS-DOS that distinguish between text and binary
files, 'cat' normally reads and writes in binary mode. However, 'cat'
reads in text mode if one of the options '-bensAE' is used or if 'cat'
is reading from standard input and standard input is a terminal.
Similarly, 'cat' writes in text mode if one of the options '-bensAE' is
used or if standard output is a terminal.
So where are the ^M's?
If you open your copy2.jpg
file in say vim
you'll see that it's littered with them, for example:
