File: com.github.babluboy.bookworm.search.sh

package info (click to toggle)
bookworm 1.1.2%2Bgit20210715-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,428 kB
  • sloc: python: 5,482; xml: 222; javascript: 84; sh: 16; makefile: 11
file content (8 lines) | stat: -rw-r--r-- 437 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
#!/bin/bash
#Written by Siddhartha Das (bablu.boy@gmail.com) as part of Bookworm (eBook Reader)
#This script searches through the contents of a book for the user provided text
#html2text utility is used to extract the text from the html content and html entities de-coded

HTML_CONTENT_TO_BE_SEARCHED=$1
USER_SEARCH_TEXT=$2
html2text -utf8 "$HTML_CONTENT_TO_BE_SEARCHED"  | tr '\n' ' ' | grep -E -o -i  ".{0,50}$USER_SEARCH_TEXT.{0,50}"