Main:
Home

Installer:
Windows Install
OSX (Dropflux)
Linux HOWTO

Documentation:
Forums
Main Docs
Command Index
Main POD
Efficiency
Module Docs
ChangeLog
TODO List
FAQ

Tutorials:
First Tutorial
Second Tutorial

Perl Modules:
WWW::URLToys
LWP::TkIO

Scripts:
Console - Modular
Console - Standalone
GUI Downloader

Extra Utils:
XTTitle for Unix
XTTitle for Win32

Contact:
Contact Me

Scripts
Tutorial

wget.u
notepad.u
jolene.u
indexes.u

Logos









 
Current Version: 1.28, updated 6/19/04 [Change Log]
URLToys Tutorial

Introduction (Continued)

Coming up is a really powerful part of URLToys, and something that when properly used, can quickly break down a list into what you care about. The commands are keep and del.

Technically, keep and del are the same command, only they arrive at the exact opposite conclusions. With keep, you explain to URLToys which URLs belong in the list, and with del, you tell it exactly which URLs need to be removed ("deleted"). To use these commands, you type in the commands name, followed by whatever text is inside of all of the URLs you are trying to perform that action on. For example, the links that have the JPEG files we want all have the word "jpg" in them, while the link we don't care about doesn't. On the other hand, the link we don't care about has "htm" in the link, as well as words like "other", "place", and "otherplace".

Actually, you can use either command. You could always use keep, and constantly refer to the things you don't want to delete, or vice-versa, using del to trim out lines that aren't important. But usually, one case is more efficient than the other. Sometimes you want to keep one unique link, and keep works out for you. Sometimes you have a handful of really similar links you'd like to delete, and del fills that niche. It doesn't matter, both are provided for convenience.

This is where you need to think about what separates the links you want from the junk. Many, many times it's very obvious, but sometimes you need to pick something out that is truely different about the good (or bad) ones, and then decide whether or not it'd be easier to refer to the keepers or the ones you are deleting. We'll try both here:
URLToys(6)>keep jpg
URLToys(5)>show
http://urltoys.gotdoofed.com/coolpictures/picture1.jpg
http://urltoys.gotdoofed.com/coolpictures/picture2.jpg
http://urltoys.gotdoofed.com/coolpictures/picture3.jpg
http://urltoys.gotdoofed.com/coolpictures/picture4.jpg
http://urltoys.gotdoofed.com/coolpictures/picture5.jpg
URLToys(5)>undo
URLToys(6)>del htm
URLToys(5)>show

http://urltoys.gotdoofed.com/coolpictures/picture1.jpg
http://urltoys.gotdoofed.com/coolpictures/picture2.jpg
http://urltoys.gotdoofed.com/coolpictures/picture3.jpg
http://urltoys.gotdoofed.com/coolpictures/picture4.jpg
http://urltoys.gotdoofed.com/coolpictures/picture5.jpg
URLToys(5)>
Note the undo command. This command will undo the last list-changing command that you used. This means that commands like show cannot be undone, and will undo the keep command before it, etc. Hopefully it's getting a little clearer what URLToys is doing, and more importantly, what you can do with it. Using keep and del, you have full control over what URLs you'd like to keep.

Important Concept: The words that you type in after keep and del aren't just word matches, even if in the simplest cases, they seem that way. You are actually giving URLToys a "Regular Expression", which is a special type of phrase that allows for all kinds of special matches. For example, the "$" symbol is special when it is at the end of the word, specifying that you want to find this text only at the end of the link. If I were to say keep jpg$, I am asking URLToys to "keep any URL that ends in 'jpg'". Regular Expressions are very, very powerful, but they're out of the scope of a simple tutorial. As you get better with URLToys, it'll help out to understand how they work.

Page 4 -->

Written by Joe Drago, Copyright (C) 2004, Under the BSD License