]> git.armaanb.net Git - charsel.git/commitdiff
More foolproof method
authorArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Thu, 15 Oct 2020 17:57:11 +0000 (13:57 -0400)
committerArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Thu, 15 Oct 2020 17:57:11 +0000 (13:57 -0400)
src/charsel

index f38d09cf23a1d148eab68c5e29be3182538b19f6..f435fde43882656299509420f85f32cf44f3b298 100755 (executable)
@@ -37,8 +37,8 @@ do
   read -N $LENGTH INPUT
   
   # Navigate to the right characther
-  OUTPUT=$(grep $INPUT $CHARFILE | cut -f 2 -d ',' -s)
-
+  LINENUMBER=$(cut -f 1 -d ',' -s $CHARFILE | grep -n $INPUT | cut -d : -f 1)
+  OUTPUT=$(cut -f 2 -d ',' -s $CHARFILE | head -$LINENUMBER | tail +$LINENUMBER)
   # Clear screen
   clear