2012-10-26 68 views
1

我想從文件&下載它們提取URL(匹配模式)。這是我的egrep表達式(在Cygwin上):重定向grep錯誤

egrep -o -e "http([^\"]*)filter=[0-9]+" myfile.html 

這很好,直到我嘗試使用重定向或管道。例如:

egrep -o -e "http([^\"]*)filter=[0-9]+" myfile.html > tmp.html 

OR

egrep -o -e "http([^\"]*)filter=[0-9]+" myfile.html | wget -i - 

錯誤: egrep: >: No such file or directory

我認爲錯誤是由於報價前的反斜槓,但我試過逃跑了。不起作用。

+0

'type egrep'說什麼? – Perleone

回答

1

我只是嘗試它,它成功地爲我CYGWIN_NT-6.1-WOW64 1.7.17(0.262/5/3) 2012-10-19 14:39

[email protected] ~ 
$ egrep -o -e "http([^\"]*)filter=[0-9]+" myfile.html >/tmp/out.txt 

[email protected] ~ 
$ cat /tmp/out.txt 
httpZADfilter=42 

我不知道,如果你已經有了一個別名猛砸了失控。