On 11/12/2011 04:09 AM, Regid Ichira wrote:
$ sed -i '$w/dev/stdout;$d' testFile sed: couldn't open file /dev/stdout;$d: Permission denied
Oops, sorry: sed -i -e '$w/dev/stdout' -e '$d' testFile
Regardless, I am not sure whether one, who is fluent in the sed language, should be able to predict the outcome of sed -i '$p'. I mean, where it is defined in which line would the content of the output will appear in the file?
sed operates strictly line-by-line. It reads "1", doesn't execute "$p" and terminates the cycle by printing "1". It reads "2", executes "$p" since it's the last line, and terminates the cycle by printing "2".
? In case you claim that with -i, the seek position of the input and output files are expected to point to the same location, subjected to possible previous operations in the script or script-file: Was I supposed to deduce that from the manual?
Yes. -i does not change the operation of sed in any way, it just provides a shorthand for replacing the original file with a modified copy.
Paolo -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org