You haven't shown a failure mode. The temporary is written with a pipe to sort -n (see the BEGIN clause), so sorting when reading it makes no sense.