Delete last line break using sed [duplicate]
问题 This question already has answers here : How can I delete a newline if it is the last character in a file? (22 answers) Closed last year . How to delete the last \n from a file. The file has a last blank line created for a line break in the last text line. I'm using this command: sed '/^\s*$/d' But that las blank line is not removed. 回答1: Why is sed printing a newline? When you read the sed POSIX standard, then it states: Whenever the pattern space is written to standard output or a named