From b8af96c80cebdd9fae0f7200937615b4958d9f2a Mon Sep 17 00:00:00 2001 From: Nathan Gass Date: Thu, 2 May 2024 11:31:20 +0200 Subject: add it_pipe grep for consistency --- it_pipe.class | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/it_pipe.class b/it_pipe.class index 03d9c69..cae4eb0 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -91,7 +91,7 @@ function map($expr) } /** - * Apply an expression to every line + * Filter lines by an expression */ function filter($expr) { @@ -100,6 +100,16 @@ function filter($expr) return $this; } +/** + * Filter lines by a regexp + */ +function grep($regexp) +{ + $this->lines = it::grep($regexp, $this->lines); + + return $this; +} + /** * Select cols from tab-separated cols in each line and tab-joins them again. Key order relevant. */ -- cgit v1.2.3