The Command Line Is Your Friend

Mar 4

The Command Line Is Your Friend

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.


Comments

Edoc Edoc
by Edoc,   March 6, 2004 9:08 PM  

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.


Edoc Edoc
by Edoc,   March 7, 2004 10:29 AM  

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.


Anonymous
by ,   June 30, 2006 7:16 AM  

Ficke dich!



Add Comment