11
votes
4answers
6k views

Delete last line from the file

I use sed to quickly delete lines with specific position as sed '1d' sed '5d' But, what if I want to delete the last line of the file and I don't know the count of lines (I know I can get that ...
2
votes
5answers
327 views

How to delete empty comments with sed?

I want to delete empty Java comments like the following: /** */ /* * * * */ I tried it with sed, but the following deletes all comments, not just the empty ones: sed -r ...