Periodically I’ll be doing an ad-hoc deploy of MVPS HOSTS file on a Mac or Android system, and have to improvise a means to accomplish the required conversion from DOS to Unix line termination from the shell prompt.
mvps.org, for their part, are a Windows shop, and publish their HOSTS file in DOS line termination only. On my own Linux system I correct it straight away with dos2unix. But on other people’s systems I’ve repeatedly found myself googling for and typing in a sed script to convert the EOLs to Unix format, which is an error prone, time consuming and basically ridiculous thing to have to do.
I have therefore thrown up a script that serves the most current Unix EOL converted MVPS HOSTS file automatically, in hopes to save myself, and maybe others, from getting bogged down in this step in the future.
Here it is: hosts with Unix EOL conversion
I have a whole guide up on how to deploy a hosts file on rooted Android. On Mac, if you’re wondering, just replace /etc/hosts, and it can be done in Terminal by any logged in user who can escalate to administrator privileges so you can su. In either case I also like to make sure the localhost lines at the start of the file match up cleanly with the original shipping version, which, fyi, this script does not do.