Replaced usage of negativ head index with AWK script