[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed N command with relative addressing
From: |
Hiroto Kagotani |
Subject: |
Re: sed N command with relative addressing |
Date: |
Sat, 17 May 2014 16:33:32 +0900 |
Hi, thank you for reply.
2014-05-16 16:47 GMT+09:00 Paolo Bonzini <address@hidden>:
> $ seq 1 10 | sed -n '/[24680]/ {; 1,+3 p; }'
> $ seq 1 10 | sed -n '/[24680]/ {; 5,+3 p; }'
> $ seq 3 10 | sed -n '/[24680]/ {; /4/,+3 p; }'
Wow, they are more confusing. I think no one can tell
why the followings are so different.
$ seq 1 10 | sed -n '/[1256789]/ {; 1,+3p; }'
1
2
5
$ seq 1 10 | sed -n '/[1256789]/ {; 2,+3p; }'
2
5
$ seq 1 10 | sed -n '/[1256789]/ {; 3,+3p; }'
5
6
7
8
I wish sed behavior is more intuitively predictable.
Regards,
--
Hiroto Kagotani
<address@hidden>