Using pdfgrep to search for sentences containing specific words

妖精的绣舞 提交于 2020-02-25 13:29:26

问题


For my statistics exam, I would like to be able to search for sentences containing specific words in our textbook (we have as a pdf file). I've downloaded the command line tool pdfgrep (grep for pdf files)

An example:

I would like to search for a sentence containing the two words "median" and "exponential"

I've tried:

pdfgrep "\..*median.*exponential\." book-IntroStatistics.pdf 

But it does not seem to be working and just gives me large chunks of text.


回答1:


You may use

pdfgrep '[^?\!.]*median[^?\!.]*exponential[^?\!.]*' book-IntroStatistics.pdf

The [^?\!.]* parts match any 0+ chars other than ?, ! and . chars.



来源:https://stackoverflow.com/questions/53558552/using-pdfgrep-to-search-for-sentences-containing-specific-words

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!