Your code relies on a number of implicit assumptions:
In reply to Re^2: sorting headers in a file by hdb in thread sorting headers in a file by utpalmtbi