#!/bin/sh
# 
# Written by:
# -- 
# John L. Weatherwax                2006-06-07
# 
# email: wax@alum.mit.edu
# 
# Please send comments and especially bug reports to the
# above email address.
# 
#-----

# Note this is trivial with the Linux command tac (the reverse of cat) which 
# does {\em exactly} what is requested
tac file2 
echo ""

# A more interesting method is the following:
grep -n "^" file2 | sort -rn -t":" +0 | cut -d":" -f2-
echo ""

# An entirely shell version is the following: 
total=
while read line
do
  total="$line
$total"
done < file2
echo "$total"
