while read line bash code example
Example 1: sh read file line by line
#!/bin/bash
input="/path/to/txt/file"
while IFS= read -r line
do
echo "$line"
done < "$input"
Example 2: bash while read line loop from variable
while read -r line
do
echo "line=[$line]"
done < <(cat jj)
Example 3: bash for each line of file
while read p; do
echo "$p"
done <peptides.txt
Example 4: read file line loop in bash
for word in $(cat peptides.txt); do echo $word; done