perl -ne 'print ++$i . <> if /energy/' filename