Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Script to convert HBA WWNs to lowercase and add ":"

by keszler (Priest)
on Dec 17, 2011 at 17:05 UTC ( #944093=note: print w/ replies, xml ) Need Help??


in reply to Script to convert HBA WWNs to lowercase and add ":"[Updated]

++ for a handy utility

Golf anyone?

perl -E'say join":",grep$_,split/(..)/,lc"10000000C9ABCDEF"' 10:00:00:00:c9:ab:cd:ef


Comment on Re: Script to convert HBA WWNs to lowercase and add ":"
Download Code
Replies are listed 'Best First'.
Re^2: Script to convert HBA WWNs to lowercase and add ":"
by hbm (Hermit) on Dec 17, 2011 at 18:11 UTC

    Ok. Fore!

    #perl -E'say join":",grep$_,split/(..)/,lc"10000000C9ABCDEF"' perl -E"$_=lc'10000000C9ABCDEF';s/..(?=.)\K/:/g;say" 10:00:00:00:c9:ab:cd:ef

      Nice! I learned something.

      I like to "correctly" handle the case where there may already be colons in the string.
      perl -E"$_=lc'02468ACE';s/[^:]{2}(?=[^:])\K/:/g;say" 02:46:8a:ce perl -E"$_=lc'02:46:8A:CE';s/[^:]{2}(?=[^:])\K/:/g;say" 02:46:8a:ce
Re^2: Script to convert HBA WWNs to lowercase and add ":"
by perl514 (Pilgrim) on Dec 28, 2011 at 17:52 UTC

    Hi keszler,

    Thank you for the encouragement. I have posted and updated version of the script. Kindly take a look and let me know.

    Perlpetually Indebted To PerlMonks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://944093]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (13)
As of 2015-07-29 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (263 votes), past polls