Important difference between Unix cat and DOS type

edit

If you specify more than one file name with cat, then the contents of each file will be joined with a newline:

$ cat foo
foo
$ cat bar
bar
$ cat foo bar
foo
bar
$

If you specify more than one file name with type, then the contents of each file are preceded with a newline, the file name, and two more newlines (the additional lines of whitespace you see before the prompts below are not from type's output). Then each of these is joined with a newline, which is why you see a blank line between "foo" and "bar.txt":

C:\>type foo.txt
foo

C:\>type bar.txt
bar

C:\>type foo.txt bar.txt

foo.txt


foo

bar.txt


bar

C:\>

Christopher C. Parker t c 18:56, 18 November 2009 (UTC)Reply