How to remove empty lines from beginning and end of file?
30
votes
10
answers
27223
views
I would like to remove empty lines from the beginning and the end of file, but not remove empty lines between non-empty lines in the middle. I think
sed
or awk
would be the solution.
Source:
1:
2:
3:line1
4:
5:line2
6:
7:
8:
Output:
1:line1
2:
3:line2
Asked by Feriman
(1069 rep)
Nov 14, 2019, 03:04 PM
Last activity: Aug 30, 2021, 11:23 AM
Last activity: Aug 30, 2021, 11:23 AM