#!/bin/bash for VHFILE in * do if sed 's/68\.12\.54\.142/65.43.123.23/g' "$VHFILE" > temp.txt \ && cat temp.txt >> "$VHFILE" \ && rm -f temp.txt then echo "Done with \"$VHFILE\"." else echo "Failure at \"$VHFILE\"." fi done