Refactored the line number parsing into one sed call. Got rid of the grep test.