From 7f7e0f4b2be5b056ec9809ecd9530ded3809ffcd Mon Sep 17 00:00:00 2001 From: Michiel Borkent Date: Sat, 10 Aug 2019 22:52:30 +0200 Subject: [PATCH] doc --- README.md | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 41ae146c..35b4ecad 100644 --- a/README.md +++ b/README.md @@ -88,35 +88,7 @@ $ ls | bb -i '(filterv #(re-find #"reflection" %) *in*)' ["reflection.json"] ``` -Shuffle the lines of a file: - -``` shellsession -$ cat /tmp/test.txt -1 Hello -2 Clojure -3 Babashka -4 Goodbye - -$ < /tmp/test.txt bb -io '(shuffle *in*)' -3 Babashka -2 Clojure -4 Goodbye -1 Hello -``` - -Find the line numbers where the word Clojure occurs using a case insensitive regex: - -``` shellsession -$ cat /tmp/test.txt -foo -Clojure is nice -bar -when you're nice to clojure - -$ < /tmp/test.txt bb -i '(map-indexed #(vector %1 %2) *in*))' | \ -bb '(keep #f(when (re-find #"(?i)clojure" (second %)) (first %)) *in*)' -(1 3) -``` +More examples can be found in the [gallery](#gallery). ## Test @@ -142,6 +114,22 @@ You will need leiningen and GraalVM. Here's a gallery of more useful examples. Do you have a useful example? PR welcome! +### Shuffle the lines of a file + +``` shellsession +$ cat /tmp/test.txt +1 Hello +2 Clojure +3 Babashka +4 Goodbye + +$ < /tmp/test.txt bb -io '(shuffle *in*)' +3 Babashka +2 Clojure +4 Goodbye +1 Hello +``` + ### Fetch latest Github release tag For converting JSON to EDN, see [jet](https://github.com/borkdude/jet).