summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Gass2024-05-02 11:31:20 +0200
committerNathan Gass2024-05-02 11:31:20 +0200
commitb8af96c80cebdd9fae0f7200937615b4958d9f2a (patch)
treeef48955998e7141df05e48f934c2abe97935e564
parent1fb9788717604a47b01cc88677d72832316c15c9 (diff)
downloaditools-b8af96c80cebdd9fae0f7200937615b4958d9f2a.tar.gz
itools-b8af96c80cebdd9fae0f7200937615b4958d9f2a.tar.bz2
itools-b8af96c80cebdd9fae0f7200937615b4958d9f2a.zip
add it_pipe grep for consistency
-rw-r--r--it_pipe.class12
1 files changed, 11 insertions, 1 deletions
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)
{
@@ -101,6 +101,16 @@ function filter($expr)
}
/**
+ * 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.
*/
function cut($picks)