Guest User

Untitled

a guest
Jul 18th, 2017
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.82 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. wget "https://blogs.msdn.microsoft.com/mssmallbiz/2017/07/11/largest-free-microsoft-ebook-giveaway-im-giving-away-millions-of-free-microsoft-ebooks-again-including-windows-10-office-365-office-2016-power-bi-azure-windows-8-1-office-2013-sharepo/"
  4.  
  5. my_title_str='<td valign=".*" width=".*"><font size=".*" face=".*">\([^<]*\)</font></td>'
  6. my_address_str='<td width=".*"><a href="\(http://[^"]*\)" target="_blank"><font size=".*" face=".*">PDF</font></a>.*'
  7.  
  8. files=$(grep -B 1 "$my_address_str" index.html)
  9. while true
  10. do
  11.   read line1 || break
  12.   title=$(echo "$line1" | sed 's,'"$my_title_str"',\1,')
  13.   read line2 || break
  14.   address=$(echo "$line2" | sed 's,'"$my_address_str"',\1,')
  15.   echo "$title"
  16.   echo "$address"
  17.   wget "$address" -O "$title"".pdf"
  18.   read line3 || break #--
  19. done <<< "$(echo -e "$files")"
Advertisement
Add Comment
Please, Sign In to add comment