需要处理的网址是连续的数字
forum-230-1.html
forum-230-2.html
forum-230-3.html
...
forum-230-100.html
对于每一个网页需要做如下处理
curl -s -N http://www.sbkd1.com/forum/forum-230-3.html |awk '/^thread/{T=$0;next;}{print T"\t"$0;}' | awk '{gsub(/<\/tbody>/,"\n")}1>>data.txt'
请问:该如何把二者结合进行遍历?
写shell脚本循环网址1-100的话,命令中有很多单引号,会出现转义错误,无法放入shell变量里。
link=‘curl -s -N http://www.sbkd1.com/forum/forum-230-3.html |awk '/^thread/{T=$0;next;}{print T"\t"$0;}' | awk '{gsub(/<\/tbody>/,"\n")}1>>data.txt'’
#awk命令里面的各种符号会导致错误
求解决方案!
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
光阴似箭催人老,日月如移越少年。