I’ve been aware of some of the goodies in the /proc filesystem, particularly the /proc/*/environ file, which yields a NULL-delimited list of environment variables in KEY=VALUE format for any process in the system. This is also the way ‘find -print0′ writes its output.
You can convert these null-delimited streams to a linefeed-delimited streams this way:
(cat /proc/1/environ; echo) | tr "\000" "\n"
This, of course, means you can use grep other text-oriented tools on the output.
Conversely, I have sometimes wished that ‘sort’ had a ‘-0′ option, but it doesn’t. There have been cases where I have to use ‘find -name *something* -print0′ to create a list of filenames containing spaces and other evil metacharacters, but then wanted to sort the list, but with no -0 option on sort, I couldn’t. Now I know I can feed find -print0 into tr "\000" "\n" and then into sort, and get what I want that way.