I can't seem to figure out how to write a regex correctly in an if statement. I wanted it to print out all the lines with "End Date" in it.
NUMBERS contains a text file with the following content:
End Date ABC ABC ABC ABC ABC ABC
05/15/13 2 7 1 1 4 5
04/16/13 4 3 0 1 3 6
03/17/13 6 9 3 8 5 9
02/18/13 8 2 7 1 0 1
01/19/13 1 9 2 2 5 2
12/20/12 7 2 7 1 0 1
Here is a snippet of my code that I am having problems with:
if [ -f $NUMBERS ]
then
while read line
do
if [ $line = ^End ]
then
echo "$line"
else
echo "BROKEN!"
break
fi
done < $NUMBERS
else
echo "===== $NUMBERS failed to read ====="
fi
The output is:
Broken!