cat $filea | while read line
do
egrep ^${line} > tmp.$$
COUNT=`wc -l tmp.$$`
if [ -s tmp.$$ ]
then
echo "${line}`cat tmp.$$`" >> output.txt
fi
done
******************************
In the instance that tmp.$$ is 2 or more lines, how do I get all the lines on the same line? I know by looking at the example above, there are better ways to do it, however, I have to output different things based on the number of results in $COUNT. Thanks in advance!