Re: [9fans] p9p sed vs linux sed

2015-08-14 Thread Alexander Kapshuk
On Wed, Aug 12, 2015 at 10:39 AM, Rudolf Sykora rudolf.syk...@gmail.com wrote: Hello, is this as expected? perseus=; echo -n aaa | 9 sed 's/^//' aaa perseus=; echo -n aaa | sed 's/^//' aaaperseus=; For me the linux sed does what I expect, but not the p9p one (it adds a newline). Why?

Re: [9fans] p9p sed vs linux sed

2015-08-14 Thread erik quanstrom
i think the change doesn't work for any multi-line file: ; cp /sys/src/cmd/sed.c /tmp/notsed.c ; cd /tmp ; ed notsed.c ; ed notsed.c 27827 putline(Biobuf *bp, Rune *buf, int n) +4 ebputc(bp, '\n'); d w 27808 q ; tmk notsed.c 6c -FVTw notsed.c 6l -o 6.notsed notsed.6 ; ; {echo a ; echo b}

Re: [9fans] p9p sed vs linux sed

2015-08-12 Thread Ingo Krabbe
| sed 's/^//' | sed 's/$//' Why would you pipe text data in acme through sed and not use Edit x/^.*$/s/.*// ?

Re: [9fans] p9p sed vs linux sed

2015-08-12 Thread Rudolf Sykora
On 12 August 2015 at 15:47, lu...@proxima.alt.za wrote: You can't write a file in vi that does not end in a newline. You, however, can do it pretty easily with cat. (Sam asks you if you mean it, acme just does it.) So, I vote that text handling utilities should deal with all lines in text

Re: [9fans] p9p sed vs linux sed

2015-08-12 Thread Ingo Krabbe
You mean perseus=; is your prompt? Strange. Actually sed is a line based command and should add a newline, imho. You can simply use tr -d '\n'. There are several quoting differences between plan9 sed and linux sed and I think the \+ operator doesn't work anyway in linux sed, but I might be

Re: [9fans] p9p sed vs linux sed

2015-08-12 Thread Rudolf Sykora
From the POSIX description (used here as some reference), when a line is entered in the pattern space, the trailing new line is discarded. When the pattern space is written to stdout it seems that implicitely the new line is restored---the POSIX description says that the input shall be a text

Re: [9fans] p9p sed vs linux sed

2015-08-12 Thread Rudolf Sykora
On 12 August 2015 at 09:48, Ingo Krabbe ikrabbe@gmail.com wrote: You mean perseus=; is your prompt? Strange. Yes. perseus=; is the prompt. Actually sed is a line based command and should add a newline, imho. I don't think it should add anything. For itself it should be able to count

Re: [9fans] p9p sed vs linux sed

2015-08-12 Thread tlaronde
On Wed, Aug 12, 2015 at 09:57:18AM +0200, Rudolf Sykora wrote: On 12 August 2015 at 09:48, Ingo Krabbe ikrabbe@gmail.com wrote: Actually sed is a line based command and should add a newline, imho. I don't think it should add anything. For itself it should be able to count newlines

Re: [9fans] p9p sed vs linux sed

2015-08-12 Thread Ingo Krabbe
Luckily plan9 is not POSIX and actually sed does not really add a newline character, it just puts a newline to the end of each pattern buffer, that is done line-wise anyway. Also sed's little brother ed behaves the same, which makes the behaviour even more convenient term% echo -n 'abc' inp

Re: [9fans] p9p sed vs linux sed

2015-08-12 Thread lucio
this, in my opinion, only complicates things. You can't write a file in vi that does not end in a newline. I never found that problematic, even though sometimes one might wish to be able to overrule vi. So, I vote that text handling utilities should deal with all lines in text files