summaryrefslogtreecommitdiffhomepage
path: root/src/blog/grab/example-1.sh
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-04-28 02:37:49 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-04-28 02:37:49 +0200
commit9463cda98b38b37cfb5bd5ee1ee5123221f046fb (patch)
treef432e82f4344c567ca2b9d046aaace8e3f5ff198 /src/blog/grab/example-1.sh
parente9edd2daec87f3f30988c83c972e028465303b70 (diff)
Add blogpost about Grab
Diffstat (limited to 'src/blog/grab/example-1.sh')
-rw-r--r--src/blog/grab/example-1.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/blog/grab/example-1.sh b/src/blog/grab/example-1.sh
new file mode 100644
index 0000000..97a4277
--- /dev/null
+++ b/src/blog/grab/example-1.sh
@@ -0,0 +1,16 @@
+$ cat foo
+Hello world, this is
+a paragraph.
+
+This is also a paragraph
+but it contains doubled
+doubled words.
+$ grab 'x/[^\n].+?(?=\n\n|$)/ g/(\b\w+\b)\s+\1/' foo
+This is also a paragraph
+but it contains doubled
+doubled words.
+$ # Just like grep, you can display match positions
+$ grab -f '…' foo
+foo:4:1:This is also a paragraph
+but it contains doubled
+doubled words.