On 16 April 2013 15:04, Glenn Fowler <[email protected]> wrote: > > thanks for the report > the work adding -C was apparently interrupted a while back > its on the todo list > > this is not an easy fix for ast grep because the fast inner loop matches > buffers containing multiple lines and does not parse line structure until > a match is found > > the only time single lines are matched is when lines cross buffer boundaries > > mmap()ing the entire file (topic under discussion) would make it easy but > would not help the very common input from pipe case > > On Tue, 16 Apr 2013 11:05:10 +0200 Wendy Lin wrote: >> On 13 April 2013 16:05, Wendy Lin <[email protected]> wrote: >> > Dear ast-devel, >> > >> > the grep -C from the latest ast-ksh (2013-04-09) does not work >> > compared to GNU grep 2.14 >> > >> > In GNU grep 2.14 I get this for the context option: >> > >> > seq 200 >"测试文件" >> > ksh -c '/usr/bin/grep --context=2 51 <"测试文件"' >> > 49 >> > 50 >> > 51 >> > 52 >> > 53 >> > -- >> > 149 >> > 150 >> > 151 >> > 152 >> > 153 >> > >> > But I get this from grep from ast-ksh for the context option: >> > >> > ksh -c 'builtin grep ; grep --context=2 51 <"测试文件"' >> > 51 >> > 151 >> > >> > Is this a bug or feature? >> > >> > AFAIK the -C option in ast-ksh grep should work like this: >> > -C 2 gives 2 lines of context before and after the match >> > -C ,2 gives only 2 lines of context after the match >> > -C 2, gives only 2 lines of contetxt before the match >> > >> > optionally AST grep should support these two long options for GNU grep >> > compatibility: >> > >> > --before-context=NUM print NUM lines of leading context >> > --after-context=NUM print NUM lines of trailing context >> > >> > What do you think? > >> Was the bug report received? >> > >> > Wendy
Glenn, how long will it take to get grep -C implemented? Wendy _______________________________________________ ast-developers mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-developers
