#!/bin/bash

infile="$1"
# echo Removing trailing whitespace from $infile and extra blank lines
if [[ ! -f $infile ]] || [ -L $infile ] ; then
    echo "USAGE: $0 infile outfile , -f $infile fails" 
    exit
fi

#echo getting rid of extra blank lines in $infile

sed -e 's/[ \t]*$//' $infile | sed '/^$/N;/^\n$/D' > /dev/shm/junkfile
mv /dev/shm/junkfile $infile

