One of the few things I find handy about Windows are .url files. But like most things, the implementation is a bit of a pain in the ass---fine for clicking on, much less fine to talk about in email. Quite a while back I wrote a quick and dirty script to get me what I needed, but then either forgot what machine the script is on or just plain lost it. Needed it again today, so I wrote another. Posting this one for anyone else who might find it handy and so as my dementia proceeds, there might be a chance I can find it again---enjoy!!
#!/usr/bin/perl # listurl.pl -- list url to stdout use strict; use warnings; use diagnostics; listurl($_) for (map {glob} @ARGV); sub listurl { open(URL,$_[0]) or die "Couldn't open $_[0]: $!"; while (<URL>) { print $1,"\n" if (/^URL=(.*)/); } }

--hsm

"Never try to teach a pig to sing...it wastes your time and it annoys the pig."

Replies are listed 'Best First'.
•Re: Listing URLs to stdout
by merlyn (Sage) on Jan 09, 2005 at 20:25 UTC
      Thank you for reminding me that I keep forgetting to use grep for something other than project maintenance! Like wise for the one liner!!

      --hsm

      "Never try to teach a pig to sing...it wastes your time and it annoys the pig."

      Golf:

      perl -pe's/^URL=|.*//s' *.url

      Unix golf:

      sed 's/^URL=//;t;d' *.url

      Makeshifts last the longest.

        You perhaps missed the handicap of playing on greens designed in Redmond WA? The above sadly produces an error message: "'.*' is not recognized as an internal or external command, operable program or batch file."

        --hsm

        "Never try to teach a pig to sing...it wastes your time and it annoys the pig."

      Hi Randal,

      Well, that may have been true before, but many of the GNU utilities have win32 native builds. Take a look at http://unxutils.sourceforge.net to get an idea.

      Jason L. Froebe

      Team Sybase member

      No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1