[R] question

Philippe Glaziou glaziou at pasteur-kh.org
Thu Nov 20 02:11:38 CET 2003


Philippe Glaziou <glaziou at pasteur-kh.org> wrote:
> I see and here is my (corrected) sed solution:
> 
> cunegonde:~/tmp> cat test
> 2.22 3.45
> 1.56 2.31
> pattern 1
> 4.67 7.91
> 3.34 2.15
> 5.32 3.88
> pattern 2
> 
> cunegonde:~/tmp> sed -e '/pattern 1\|pattern 2/D' <test
> 2.22 3.45
> 1.56 2.31
> 4.67 7.91
> 3.34 2.15
> 5.32 3.88


Ray Brownrigg rightly pointed out my mistake: we want the lines
between the patterns not just to remove the patterns. I pulled
the trigger too fast.

cunegonde:~/tmp> sed -e '/pattern 1/,/pattern 2/!D;/pattern 1\|pattern 2/D' <test
4.67 7.91
3.34 2.15
5.32 3.88


I feel embarrassed now. 

-- 
Philippe




More information about the R-help mailing list