#!/bin/bash while IFS= read -r line; do ping -c2 $line>>file1 2>>file2 done < ips.txt