shithub: hl

Download patch

ref: dc2d2e4241473bae7f7f37b3bf261582d571b04a
author: demyxology <spicycoldnoodles@gmail.com>
date: Thu Jan 2 18:03:14 EST 2025

highlight text based on regex

--- /dev/null
+++ b/hl
@@ -1,0 +1,13 @@
+#!/bin/rc
+
+esc=`{awk 'BEGIN{ printf "%c", 27 }' }
+
+if(~ $#* 0){
+    echo -n $esc 
+    cat
+    echo -n $esc
+} 
+if not {
+    regex=$*(1)
+    sed 's/(' ^ $regex ^ ')/' ^ $esc ^ \1 ^ $esc/g
+}