On Tue, 25 Oct 2016, Tomi Ollila <domo141@gmail.com> wrote:
> Jani Nikula <jani@nikula.org> writes:
>
>> Use /etc/mime.types if available, with a homebrew sed parser, and fall
>> back to a handful of common types otherwise.
>
> I'd suggest the following line:
>
> sed -n '/^[[:alpha:]]/ s/[[:space:]].*//p' /etc/mime.types
>
> I tested the sed expression works on Linux and Darwin (macOS sierra).
$ sed --version
sed (GNU sed) 4.2.2
$ sed -n '/^[[:alpha:]]/ s/[[:space:]].*//p' /etc/mime.types | wc -l
411
$ sed -n '/^[^ \t#]/{s/[ \t].*//;p;}' < /etc/mime.types | wc -l
787
BR,
Jani.