Airlines are facing the dual challenge of combatting a shortage of pilots while keeping a lid on costs.