# Generate list from CSV list=$(awk -F, '{print $1}' csv_input.csv) # Create empty output file echo > output_file.txt # Loop through list for i in $list; do # Output stuff with the list variable cat << EOF Stuff and things ${i} ${i} other stuff and things EOF # Finish the loop and output to file done >> output_file.txt