Hello:
I wrote a sed statement that is inserting 3 variables at the beginning of each record in a comma-delimited file:
for FILE in *gnrc_lkup.csv
do
c=`echo $FILE | cut -c1-3`
d=`grep $c $RTLIST | cut -c4-6`
e=`grep $c $RTLIST | cut -c7`
f=`grep $c $RTLIST | cut -c8`
sed -e 's/^/'$d','$e','$f',/' < $FILE > $FILE.new
done
However, after further testing, I noticed that the
last record is being removed. Can someone tell me what part of the sed statment above would be doing this and how it can be corrected?
There is no newline at the end. I think
during editing it got removed. Even though this was not a valid text file by your definition, do you know why the sed command would work
on all but the last data record which it removed? Your input is appreciated. Thanks, Brett