背景:
我使用以下正则表达式:
grep -iIrPoh 'https?://.+?\s' . --include=*.txt --include=*.rtf > output.txt
Run Code Online (Sandbox Code Playgroud)
问题
我的目录"stuff"的当前大小是180 KB,包含26个文件.在终端,我cd到这个目录(东西)然后运行我的正则表达式.我等了大约15分钟,决定杀死这个过程,因为它没有完成.当我查看output.txt文件时,它是一个惊人的19.75GB(截图).
题
提前感谢您提供的任何指导.我已经在我的正则表达式的许多不同变体上工作了将近16个小时,并且已经在线阅读了大量的帖子,但似乎没有任何帮助.我是新手写的正则表达式,但只要握一点,我想我会得到它.
附加评论
我运行以下命令来查看output.txt(19.75GB)文件中记录的内容.看起来正则表达式找到了正确的字符串,除了我认为奇怪的字符,如:花括号} {和字符串,如:{\fldrslt
**TERMINAL**
$ head -n 100 output.txt
http://michacardenas.org/\
http://culturelab.asc.upenn.edu/2013/03/06/calling-all-wearable-electronics-hackers-e-textile-makers-and-fashion-activists/\
http://www.mumia-themovie.com/"}}{\fldrslt
http://www.mumia-themovie.com/}}\
http://www.youtube.com/watch?v=Rvk2dAYkHW8\
http://seniorfitnesssite.com/category/senior-fitness-exercises\
http://www.giac.org/
http://www.youtube.com/watch?v=deOCqGMFFBE"}}{\fldrslt
http://www.youtube.com/watch?v=deOCqGMFFBE}}
https://angel.co/jason-a-hoffman\
https://angel.co/joyent?save_req=mention_slugs"}}{\fldrslt
http://www.cooking-hacks.com/index.php/ehealth-sensors-complete-kit-biometric-medical-arduino-raspberry-pi.html"}}{\fldrslt
http://www.cooking-hacks.com/index.php/ehealth-sensors-complete-kit-biometric-medical-arduino-raspberry-pi.html}}
http://www.cooking-hacks.com/index.php/documentation/tutorials/ehealth-biometric-sensor-platform-arduino-raspberry-pi-medical"}}{\fldrslt
http://www.cooking-hacks.com/index.php/documentation
Run Code Online (Sandbox Code Playgroud)
到目前为止测试的正则表达式命令目录
grep -iIrPoh 'https?://\S+' . --include=*.txt --include=*.rtf > output.txt
失败:用1秒钟来运行/生成空白文件(output_2.txt)
grep -iIroh 'https?://\S+' . --include=*.txt --include=*.rtf > output.txt
失败:用1秒钟运行/生成空白文件(output_3.txt)
grep …
我想了解HTML,JS和CSS如何协同工作并相互引用.
我发现HTML可以通过id引用引用CSS.
例:<div id="left-show"></div>
但是,如果有人能澄清以下内容,我们将不胜感激: