for($s=0;$s<=4;$s++) { $value = `awk 'NR=='$s' {print $4}' comms_input` echo $value; }