Looping through the content of a file in Bash

后端 未结 13 2367
傲寒
傲寒 2020-11-21 10:08

How do I iterate through each line of a text file with Bash?

With this script:

echo \"Start!\"
for p in (peptides.txt)
do
    echo \"${p}\"
done
         


        
13条回答
  •  说谎
    说谎 (楼主)
    2020-11-21 10:37

    @Peter: This could work out for you-

    echo "Start!";for p in $(cat ./pep); do
    echo $p
    done
    

    This would return the output-

    Start!
    RKEKNVQ
    IPKKLLQK
    QYFHQLEKMNVK
    IPKKLLQK
    GDLSTALEVAIDCYEK
    QYFHQLEKMNVKIPENIYR
    RKEKNVQ
    VLAKHGKLQDAIN
    ILGFMK
    LEDVALQILL
    

提交回复
热议问题