OK, thanks.
Guess I will have to find-out more about sed, grep and awk.
Someone wants me to port SDM to SX200IS.
Having looked at the CHDK code I am not looking forward to this.
The handling of bitmap and viewport buffers looks fairly messy.
I assume it is correct but will try drawing some test patterns to check.