Another thing about the Linux shell I keep forgetting is reading input from file one line after another…

Another post to help my memory: Reading a file line by line and doing something with each line. This link has some great examples – Here’s my favorite because so simple one. It’s easy to craft it into one line of code, too. Takes your file to be processed as first parameter (“$1”).

Linux/UNIX: Bash Read a File Line By Line – nixCraft

How to Read a File Line By Line in Bash Here is more human readable syntax for you:

#!/bin/bash
input=”$1″
while IFS= read -r line
do
    echo “$line”
done < “$input”