#! /usr/bin/gawk -f # Assumes the input text has been reversed (with "tac") # Prepends each input line with its sequential number from the end of the paragraph (starting with 1) BEGIN { NLIN=0 } /./ { if ( /=/ ) NLIN=0 NLIN++ printf "%3d %s\n", NLIN, $0 }