in reply to sort file with your own logic
The roles of $a and $b are explained in detail in the documentation with many examples.