![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2005
Posts: 3
Rep Power: 0
![]() |
command to download a webpage
i am very new with bash scripting..shell scripting in general!! does anyone know how i can download a webpage and then display all the links in it??? something to do with the html code..a=href...
light peace love chim wafflekisser |
|
|
|
|
|
#2 |
|
Professional Programmer
|
you'll need to download the page with 'wget' then parse it using 'egrep' and regular expressions or so, check the man pages of these two programs to learn about them.
I think the regex will look something like this, but don't quote me because i could be wrong s/<a href="(.*)">(.*)</a>/ now $1 will be the linked page, and $2 the title of the link. -Dizz |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Oct 2005
Posts: 3
Rep Power: 0
![]() |
how about if i need to recursively search thru a directory for all the TEXT files contained in it? i need to supply one or two keywords for this, which i must use as arguments..any idea?? or is my question a bit unclear?? hee..thanks!!
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() |
find `pwd` -name "*.txt"
__________________
|
|
|
|
|
|
#5 |
|
Newbie
Join Date: Oct 2005
Posts: 3
Rep Power: 0
![]() |
i will try this, thanks. is that how you do it with shell scripting? i need to write it in .sh format..i need to write my code in vi and then run it then supply my arguments.. first the directory and then the filename..
.:."I'll tell you what's the matter!! This parrot is dead!!".:. |
|
|
|
|
|
#6 |
|
Professional Programmer
|
in the future, start a new thread with a new question, that way the forum becomes more searchable for other users.
|
|
|
|
|
|
#7 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 321
Rep Power: 4
![]() |
In answer to the "download web page from the shell prompt/in a shell script, display links" question at the top; I think wget does this conveniently. If you're on a linux box you probably already have it; if not, it's free and small. Google for it.
|
|
|
|
|
|
#8 | |
|
Newbie
|
Quote:
Not sure of the question, but I think your asking how to use arguments with shell scripts ?? Each argument is given a number. So the first argument to the file is $1 the second $2 and so forth. The script itself is $0. Which is handy to use in case the file name changes down the track. Functions in shell scripts also use this same format, so its wise to assign the arguments to better variables at the start of the script. EG var_one="$1" var_two="$2" |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|