Sample Header Ad - 728x90

sed remove lines in range

5 votes
3 answers
6122 views
I have an xml file. I am trying to remove only the blank lines from a range of lines. In this example I want to check lines 55-57 and remove any blank lines. This needs to be done in a shell script over multiple files that are all xml. This is a RHEL 7 system. I tried using sed, but wasn't able to strip the empty lines out. I have written statements that get the appropriate line numbers, they are stored as vars in the shell script (start_line, finish_line) Example File: 1. 2. 3. . . . 55. 56. 57. 58. What can I do to remove the blank lines only from range 55-57?
Asked by Enter Strandman (149 rep)
Jun 17, 2020, 02:46 PM
Last activity: Aug 28, 2024, 09:05 PM