/etc/hosts a partir de CSV
Monta entradas /etc/hosts a partir de CSV (ip,hostname por linha).
hosts file
—
From a spreadsheet of IPs to a hosts file
Someone handed you a list of machines as CSV, IP in the first column and hostname in the second, and you need it in hosts file format, where the fields are separated by a space or a tab. Retyping forty lines by hand is exactly where the typo comes from that costs you an hour of debugging later. Paste the CSV and each line becomes an entry with the IP, a tab and the hostname.
The conversion runs line by line and drops anything missing either field, so blank lines and lines without a comma disappear. What it does not do is recognize a header row: if your CSV starts with ip,hostname, that line becomes a literal entry containing the words ip and hostname. Delete it first. Extra columns past the second comma are ignored, and the IP is never validated, so 999.1.2.3 sails right through.
Double-check the line breaks after pasting into your editor, and remember the file lives at /etc/hosts on Linux and macOS and at C:\Windows\System32\drivers\etc\hosts on Windows, needing administrator rights either way. A hosts file accepts no wildcards and no ports: *.dev will not work and the name has to match exactly. On macOS, flush the cache afterwards with sudo dscacheutil -flushcache and sudo killall -HUP mDNSResponder. The conversion runs in your browser.
Frequently asked questions
Can I keep comment lines in the CSV?
How do I point several names at the same IP?
Does it work with IPv6 addresses?
Related Tools
OAuth2 Authorization URL Builder
Monta URL de autorização OAuth 2.0 com response_type, client_id, redirect_uri, scope, state.
JSON ↔ CSV Converter
Convert data between JSON (array of objects) and CSV bidirectionally. Paste and convert instantly in the browser, no file upload needed.
CSV Validator & Viewer
Validate, parse and visualize CSV data in table format. Automatically detects delimiters (comma, semicolon or tab) and highlights formatting errors.