FILE=keyvalues.txt index=1 while read -r line; do if [[ $(expr index%2) -ne 0 ]]; then key=$line else val=$line echo "$key = $value" fi (( index++ )) done < $FILE