Linux Shell web page capture

Source: Internet
Author: User
 args.txt 
#! /Bin/bash if [-Z $1] | [! -E $1] thenecho "Usage: cmd. sh input "exitfiecho $ 0for num in $ *; do echo" $ num "Done For I in $(SEQ-3 $ #); do echo $ I done for I in {0 .. 5} Do echo $ I done echo $ @ for (I = 4; I <7; I ++); Do echo $ I done echo "All: $ "trimreg =" s/\ (^ *\)\(. * [^] \) \ (* $ \)/\ 2/"tmpfile = 'cat/proc/sys/kernel/random/UUID 'while read line; do value =$ {line # * =} key =$ {line % = *} key = 'echo $ {key} | sed-e "$ {trimreg}" 'value = 'echo $ {Value} | sed-e "$ {trimreg}" 'If ["$ key" = "url"] Then url = $ value Elif ["$ key" = "beginwith"] Then beginwith = $ value Elif ["$ key" = "endwith"] Then endwith = $ value Elif ["$ key" = "pagereg"] Then pagereg = $ value Elif ["$ key" = "savepath"] Then savepath = $ value Elif ["$ key" = "prefix"] Then prefix = $ valueelif ["$ key "=" proxy "] thenproxy = $ value fi done <$1 echo" url: $ URL "Echo" beginw Ith: $ beginwith "Echo" pagereg: $ pagereg "Echo" endwith: $ endwith "Echo" Prefix: $ prefix "Echo" Proxy: $ proxy "Echo" savepath: $ savepath "Echo" tmpfile: $ tmpfile "If [-Z $ proxy] thencontent = 'curl-S $ URL | iconv-f gbk-T UTF-8 'elsecontent = 'curl-x $ proxy-S $ URL | iconv-f gbk-T UTF-8 'fi length = 'expr length "$ {content}" 'echo "Download: $ Length byte (s) "content =$ {content # * $ {beginwith} content =$ {content % $ {end With} *} length = 'expr length "$ {content}" 'echo "after filer: $ Length byte (s) "Echo $ content | grep-po" $ pagereg "| uniq> $ savepathawk '{A [$0] ++} end {for (m in) print m} '$ savepath> $ tmpfileif [! -Z $ prefix] thensed "s/^/$ prefix/g" $ tmpfile> $ savepathelsecp $ tmpfile $ savepathfrem-F $ tmpfile STR = "0000012345456789000000" Echo $ STR # STR = expr substr $ STR 1 2 # STR =$ {STR: 2: 3} STR =$ {STR # * 0} echo $ STR # trim the string STR = "s =" str = 'echo $ STR | sed-e "$ {trimreg }" 'echo [$ STR] echo $ STR | sed-e "$ {trimreg }"

 

 
Url = focus. news.163.combeginwith = <ul class = "focuslist-1" id = "focusTab-1"> pagereg = (? <= Href = \ ") http: // focus \. News \. 163 \. com/[\ D] +. +? (? = \ ") Endwith = <Div class =" con-4 "area Clearfix"> savepath = 163.txt

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.