kuldietercastel

hostsToTxt.sh

Mar 2nd, 2013
57
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # hostsToTxt.sh
  2. # Converts the available-host-site to a text file.
  3. #
  4. # Description:
  5. #   This script gets the file with the available hosts with wget and places it in the directory ~/wgetted.
  6. #   Next it converts the html to a txt file and places it in ~/toSend/.
  7. #
  8. # WARNING: Changing the directory or file names is not a good idea if you use this script in combination with the retrieveHosts.sh script.
  9. #
  10. # Version:  1.0
  11. # Author:   Dieter Castel
  12. # License:  Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
  13. #           See: http://creativecommons.org/licenses/by-nc-sa/3.0/ for more info.
  14.  
  15. # Makes directories if needed and removes the old files.
  16. mkdir ~/wgetted
  17. rm -f ~/wgetted/hosts.html
  18. mkdir ~/toSend
  19. rm -f ~/toSend/hosts.txt
  20.  
  21. # Retrieves the file as html
  22. # -v for verbose
  23. # -F for certainly using html
  24. # -N for using timestamping
  25. # --no-use-server-timestamps for using the local time
  26. wget -v -F -N --no-use-server-timestamps http://mysql.cs.kotnet.kuleuven.be/ -O ~/wgetted/hosts.html
  27. # Convert the html file to a text file and place it in the toSend directory.
  28. html2text ~/wgetted/hosts.html > ~/toSend/hosts.txt
RAW Paste Data