View Full Version: Cool Bash Script to download APNotes

Apnotes > Technical > Cool Bash Script to download APNotes



Title: Cool Bash Script to download APNotes


AndrewTheArt - April 27, 2008 05:07 PM (GMT)
Hey guys,

If anybody here uses Linux/Unix, then they can take advantage of this cool Bash script I made to download all the APNotes chatpers (1-41) into one massive text file.

You need to have Lynx installed for this to work - in Ubuntu, just type -

CODE
sudo apt-get install lynx


Here are the one-liners you can paste in your terminal to get the notes-

One massive text file with all chapters

CODE
for i in $(seq 1 41); do lynx -dump http://www.apnotes.net/ch${i}.html >> ApNotesAllChapters.txt; done;


Individual text files for each chapter

CODE
for i in $(seq 1 41);do lynx -dump http://www.apnotes.net/ch${i}.html >> Ch${i}APNotes.txt; done;


Here are the"script" versions of the above (basically just prettier formatting)

One massive text file with all chapters

CODE
#/bin/bash
for i in $(seq 1 41);
do
lynx -dump http://www.apnotes.net/ch${i}.html >> ApNotesAllChapters.txt;
done


Individual text files for each chapter

CODE
#/bin/bash
for i in $(seq 1 41);
do
lynx -dump http://www.apnotes.net/ch${i}.html >> Ch${i}.txt;
done


Enjoy, and give me credit if you post this elsewhere, please :D :D :D

- Andrew




Hosted for free by InvisionFree