[SLL] Scripting Question

Robert Woodcock rcw at blarg.net
Wed Oct 3 22:43:33 PDT 2007


On Wed, Oct 03, 2007 at 03:30:48PM -0700, Eric wrote:
> I am biting the bullet and trying to learn more about shell and perl 
> scripting.  I have two unrelated questions.
> 
> 1.  Using perl regular expression, how could I match a string followed 
> by a period and a digit? The string doesn't have to include the period 
> and digit though. For example, I'd want to match something like this:
> 
> string
> string.2
> 
> but not:
> 
> strings
> string9
> string.
> strings.2
> 
> So far I've come up with
> /^string\.?[0-9]?/

$ cat /tmp/testfile
string
string.2
strings
string9
string.
strings.2
$ perl -ne 'print if /string($|\.\d)/;' /tmp/testfile
string
string.2

> 2.  I have a wireless card that I am trying to track since its 
> removeable.  Sometimes it shows up as wlan0 or wlan1.  The only thing 
> that differentiates it is the driver, since its different than the 
> others.  How could I pull the driver info and relate it to wlan0 or wlan1?

Surely each network card would have a unique MAC address? Parse the output
of "ifconfig" or "ip link" (or easier: "ip -o link") to find it.
-- 
Robert Woodcock - rcw at blarg.net
"Use your liberty to promote ours."
	-- Aung San Suu Kyi


More information about the linux-list mailing list