|
From: | Assaf Gordon |
Subject: | Re: Why isn't "sed -n p" identical to "cat"? |
Date: | Fri, 11 Jan 2019 01:16:17 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
Hello, On 2019-01-09 4:43 p.m., Eric Blake wrote:
On 1/9/19 4:40 PM, Assaf Gordon wrote:Not sure if it's a bug or an unspecified edge-caseOn 2019-01-09 3:12 a.m., Michael Green wrote:[...] it raises a question of where the newline is coming from in the following command: printf a | sed -n 'x;p'That command is unspecified by POSIX; implementations can do whatever they want.[...]If your input does not end in newline, it is not a text file, so you can't appeal to POSIX for what will happen.
Thank you, Eric. Based on the above, I'm inclined to leave the code as-is. Perhaps an explicit paragraph about such non-text files should be added to the manual, I'll look into writing one. -assaf
[Prev in Thread] | Current Thread | [Next in Thread] |