Last active
November 20, 2018 04:33
-
-
Save canabady/9650d8c604b5a93cb779534352660c20 to your computer and use it in GitHub Desktop.
To filter id and title from json file and output to html for ebook creation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Select id and title from JSON File based on TEXT_TO_SEARCH and append it to OUTPUT.html | |
$ for f in $(find $PWD -name "JSON_FILE.json"); do idTitleTextArray=($(cat $f | jq -r -c '.categories[].articles[] | select(.title | contains("TEXT_TO_SEARCH"))|"\(.id).html\">\(.title)</a>"'|sort)); if [ ${#idTitleTextArray[@]} -gt 0 ];then echo "<a href=\"${f%/*}/web/html/${idTitleTextArray[@]}" >> OUTPUT.html; fi; done; | |
# Create MOBI ebook from HTML | |
$ ebook-convert OUTPUT.html OUTPUT.mobi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment