The Command Line Is Your Friend

By on March 4, 2004

If you’re in the tech field, it might behoove you to know your command line utilities, and to have a copy of Cygwin handy if you run Windows. There are reasons why those old-school UNIX guys look down their long beards at the rest of us with disdain for not knowing the system shell. I ran across a great use of command line tools today that I thought I’d share.

Gadgetopia

Comments

  1. You could also use Rebol http://www.rebol.com to handle most of this in a few short lines of code (including the wget piece of this). Although it’s a bit more verbose, the code would likely be much more readible and simpler for those unfamiliar with shell scripts.

    For example, the sed part can be accomplished with the following parse statement:

    IDs: [] parse/all read %transfer.log [ any [thru “cid=” copy ID to newline (append IDs ID)] ] sort IDs

    It’s always gratifying to solve something tedius with a shell script, and I’m not saying my way is better. If your interested in more info, I can post a short article that lists & exmplains the REBOL code for this entire task. The code would probably be 15 lines or so.

  2. Looking more closely at the wget log, I need to correct the parse code to:

    parse/all read %transfer.log [ any [thru “?cid=” copy ID to newline (append IDs ID)] ]

    The only change is the “?” in the match pattern. This makes sure we exclude the other lines of the log that have “@cid=” in them.

Comments are closed. If you have something you really want to say, email editors@gadgetopia.com and we‘ll get it added for you.