#!/bin/sh # list="" inputfile="myfile" # Setting the name of your input file separator="^K" # Change this to a single control character that is harmless and unlikely in your input file. while read aline do # Ignore blank lines if [ "$aline" != "" ] && ! expr "$aline" : '[ \t]*$' > /dev/null then list="$list$separator$aline" fi done < myfile IFS=$separator # Set the builtin input field separator string. for value in $list do echo "$value" done