2012-10-26 69 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 

我不知道,如果你已经有了一个别名猛砸了失控。