Many thanks Bitt

Knowing very little about file manipulation under Linux I'm going to try and attack this from the other end, I'll see if I can change the way the file is generated to remove the last LF.