-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b20a3f1
commit 117e8df
Showing
8 changed files
with
195 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/bin/sh | ||
# | ||
# thisdoes: working version of rgpre | ||
# ColonelBuendia was here, 2019-11-20, also later | ||
# | ||
# ubuntu wants: poppler-utils p7zip w3m | ||
# termux wants: poppler p7zip w3m | ||
# | ||
# alias rgi="rg -i -z --max-columns-preview --max-columns 500 --hidden --no-ignore --pre-glob \ | ||
# '*.{pdf,xl[tas][bxm],xl[wsrta],do[ct],do[ct][xm],p[po]t[xm],p[op]t,html,htm,xhtm,xhtml,epub,chm,od[stp]}' --pre rgpipe" | ||
# | ||
# note to self re: less usage | ||
# export LESSOPEN="|/home/sanchopanda/scripts/rgpipe %s" | ||
# LESSOPEN="|lesspipe.sh %s" | ||
# | ||
# note to self re: fzf usage | ||
# f-cd() { cd $( dirname "$(locate -i "$1" | fzf --preview 'rg -iz --pre rgpipe . {} | head -n 100')") ; } | ||
# f-less() { less `locate -i "$1" | fzf --preview 'rg -iz --pre rgpipe . {} | head -n 100'`; } | ||
# f-subl() { subl `locate -i "$1" | fzf --preview 'rg -iz --pre rgpipe . {} | head -n 100'`; } | ||
# | ||
# note to self re: mobi files | ||
# A simple way is to use [this script](https://github.com/kevinhendricks/KindleUnpack/archive/v032.zip) but it writes to disk so I don't really. | ||
# Any notes on how to do this using the existing tools here would be highly appreciated. | ||
# | ||
# note to self re: key files as in apple keynote | ||
# Use someting like Snzip to do it right. Note the format has varied over time without changing extension, and that key files are often otherwise greppable text files in other contexts. | ||
# garbage methord: unzip -qc "$1" */Slide* */*/Data | strings -n 13 | ||
#Some [notes](https://github.com/obriensp/iWorkFileFormat/blob/master/Docs/index.md#snappy-compression) on [keynote files](https://github.com/kubo/snzip/issues/14) | ||
# | ||
# Superior tools for more robust usage when doing that | ||
# catdoc, catppt, xls2csv, xlsx2csv, ods2txt, ebook-convert, ssconvert, in2csv, html2csv(pip3 html-to-csv), psc | ||
# | ||
|
||
case "$1" in | ||
*.pdf) | ||
# exec pdftotext -q -layout "$1" - | ||
exec rga-preproc "$1" | ||
;; | ||
*.xl[ast][xmt]) | ||
exec unzip -qc "$1" *.xml | sed -e 's/<\/[vft]>/\n/g; s/<[^>]\{1,\}>//g; s/[^[:print:]\n]\{1,\}//g' | ||
;; | ||
*.xlsb) | ||
unzip -qc "$1" *.bin | strings -e l | ||
;; | ||
*.xl[wsrta]) | ||
exec strings "$1" | ||
;; | ||
*.do[ct]) | ||
exec strings -d -15 "$1" | ||
;; | ||
*.do[tc][xm]) | ||
exec unzip -qc "$1" word/document.xml | sed -e 's/<\/w:p>/\n/g; s/<[^>]\{1,\}>//g; s/[^[:print:]\n]\{1,\}//g' | ||
;; | ||
*.p[po]t) | ||
exec strings -d "$1" | ||
;; | ||
*.p[po]t[xm]) | ||
exec unzip -qc "$1" ppt/slides/*.xml | sed -e 's/<\/a:t>/\n/g; s/<[^>]\{1,\}>//g; s/[^[:print:]\n]\{1,\}//g' | ||
;; | ||
*.xhtm) | ||
w3m -T text/html -dump -cols 120 "$1" | ||
;; | ||
*.xhtml) | ||
w3m -T text/html -dump -cols 120 "$1" | ||
;; | ||
*.htm) | ||
w3m -T text/html -dump -cols 120 "$1" | ||
;; | ||
*.html) | ||
exec cat "$1" | w3m -T text/html -dump -cols 120 | ||
;; | ||
*.epub) | ||
exec unzip -qc "$1" "*.*htm*" | w3m -T text/html -dump -cols 120 | ||
;; | ||
*.chm) | ||
exec 7z e -r -so "$1" *.htm *.xml *.htm *.html *.xhtm *.xhtml | w3m -T text/html -dump -cols 120 | ||
;; | ||
*.od[stp]) | ||
exec unzip -qc "$1" *.xml | sed -e 's/<\/text:p>/\n/g; s/<[^>]\{1,\}>//g; s/[^[:print:]\n]\{1,\}//g' | ||
;; | ||
*) | ||
case $(file "$1") in | ||
*Zstandard*) | ||
exec pzstd -cdq "$1" | ||
;; | ||
*) | ||
exec cat "$1" | ||
;; | ||
esac | ||
;; | ||
esac |
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
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