bash loop through file code example
Example 1: bash iterate over lines of a file
while read p; do
echo "$p"
done <peptides.txt
Example 2: bash for each line of file
while read p; do
echo "$p"
done <peptides.txt
Example 3: for loop in bash for files
#!/bin/bash
FILES=/path/to/*
for f in $FILES
do
echo "Processing $f file..."
# take action on each file. $f store current file name
cat $f
done