I\'m trying to figure out how to display the contents of a file through unix where the spaces and tabs are marked somehow. I know how to display the files with tabs (aka c
The answer to your question: No, cat command can not "show" spaces as a visible characters. It just does not contain such a feature. Cat only provides -T (show tabs) or -E (show newlines) or -A (show both types).
I assume palako was meaning to say this, but instead he he jumped straight to providing you a workaround, which is valid. If you are looking to visually count spaces, that's fine. There are many workarounds, and not all will be appropriate for all users.
If you need something different, I suggest looking into Perl one-liners (because they could adapt easily into existing UNIX scripts), or write something in Python which mimics 'cat' but replaces spaces with another character, much like palako's "tr" example.
There's a standard unix tool for character substitution. In this example, I'm replacing spaces for * and tabs for &:
$ cat tmp
space tab space tab end
tab space tab space end
$ cat tmp | tr " " "*" | tr "\t" "&"
space*tab&space&tab&end
tab&space&tab*space*end