#!/bin/bash while read $line do ip=$(echo $line | cut -d ' ' -f 1) hostname=$(echo $line | cut -d ' ' -f 2) done < ./hosts