用 Shell 在 PDF 檔案中,找出指定字串

From: http://stackoverflow.com/questions/14449968/find-string-inside-pdf-with-shell

Find string inside pdf with shell

As nicely pointed by Simon, you can simply convert the pdf to plain text using pdftotext, and then, just search for what you’re looking for.

After conversion, you may use grep, bash regex, or any variation you want:

while read line; do

    if [[ ${line} =~ [0-9]{4}(-[0-9]{2}){2} ]]; then
        echo ">>> Found date;";
    fi

done <<(pdftotext infile.pdf -)
廣告

關閉 vim 搜尋的反白 指令

來源:http://usagiblog.wordpress.com/2006/03/03/%E9%97%9C%E6%96%BC-vim-%E7%9A%84%E6%90%9C%E5%B0%8B%E5%8F%8D%E7%99%BD/

關於 vim 的搜尋反白

各家 distrobution 或者各個工作站的 global settings 裡的 vimrc 可能都有各自的設定, 若您遇到的環境剛好預設把「搜尋反白」打開(set hlsearch), 說不定您會想把它關掉.

如果是搜尋動作完, 想把反白弄掉而已, 可以用「讓 vim 搜尋一段檔案裡不可能出現的字串」的方式, 我的習慣是打:

/aaaaaaaaaaaaaaaaaaaaaa

若想暫時關掉, 可打:

:set nohlsearch

或是打上:
:noh

若想把這功能永遠關閉的話, 在 ~/.vimrc 裡寫入 set nohlsearch 就可以了.

Extract Images from an Excel Document

出至:http://stackoverflow.com/questions/5503015/extract-images-from-an-excel-document

First, use unoconv to convert the .xls to .pdf:

http://dag.wieers.com/home-made/unoconv/

On Ubuntu 10.10 command line:

sudo apt-get install unoconv
unoconv -f pdf file.xls
Then extract the images from the pdf using pdfimages (which seems to come bundled with Ubuntu):

http://en.wikipedia.org/wiki/Pdfimages

Back on the command line:

pdfimages file.pdf fileimage
And done! All of the images in the .xls are now in separate files in the directory. This could be done very easily on most Linux systems using your language of choice. In python, for example:

import subprocess
subprocess.call([‘unoconv’,’-f’,’pdf’,’file.xls’])
subprocess.call([‘pdfimages’,’file.pdf’,’fileimage’])

I would love to hear a simpler solution if somebody has one.
******************************************************************************************

If a excel file is a compressed file.(xlsx)

$ unzip file.xlsx

in xl/media/ are all pictures

How do I indent multiple lines quickly in vi ? ( vim 如何多行縮排)

出至:http://stackoverflow.com/questions/235839/how-do-i-indent-multiple-lines-quickly-in-vi

Use the > command. To indent 5 lines, 5>>. To mark a block of lines and indent it, Vjj> to indent 3 lines (vim only). To indent a curly-braces block, put your cursor on one of the curly braces and use >%.

If you’re copying blocks of text around and need to align the indent of a block in its new location, use ]p instead of just p. This aligns the pasted block with the surrounding text.

Also, the shiftwidth setting allows you to control how many spaces to indent.

wget下載 sun jdk , 解決 wget 缺陷

基於 wget 重定向問題,我們可以「欺騙服務器」,即添加一些參數

#wget –no-cookie –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" http://download.oracle.com/otn-pub/java/jdk/7u10-b18/jdk-7u10-linux-i586.rpm

然後把下載來的 jdk 改名
#mv jdk-7u7-linux-* jdk-7u10-linux-i586.rpm

截取至:http://www.cnblogs.com/wanghaosoft/archive/2013/01/12/2857411.html