Loading ...
Sorry, an error occurred while loading the content.
 

Re: string help

Expand Messages
  • dinakar_u
    Hi, I think This could help You. print mac: $hostmac, port: Gi$hostport n ; print mac: $hostmac, port: . Gi . $hostport n ; Cheers, ... port ... 9a-f] ...
    Message 1 of 2 , Jul 4, 2005
      Hi,
      I think This could help You.
      print "mac: $hostmac, port: Gi$hostport \n";
      print "mac: $hostmac, port: "."Gi"."$hostport \n";
      Cheers,

      --- In beginning_perl@yahoogroups.com, "c_dito" <c_dito@y...> wrote:
      > Hi,
      > I'm debugging code written by someone else.
      > How do I modify the code to include the 'Gi' on the front of the
      port
      > number?
      > here's the input:
      > 300 0000.0c07.ac02 DYNAMIC Gi1/0/12
      > here's the code:
      > if (/([0-9a-f]{2})([0-9a-f]{2})\.([0-9a-f]{2})([0-9a-f]{2})\.([0-
      9a-f]
      > {2})([0-9a-f]{2})\s+.*(\d+\/\d+\/\d+)/)
      > {
      > $hostmac = $1 . "-" . $2 . "-" . $3 . "-" . $4 . "-" .
      $5 . "-
      > " . $6 . $7;
      > $hostport = $7;
      > print "mac: $hostmac, port: $hostport \n";
      > }
      > here's the actual output:
      > mac: 00-00-0c-07-ac-02, port: 1/0/12
      >
      > here's the desired output:
      > mac: 00-00-0c-07-ac-02, port: Gi1/0/12
    Your message has been successfully submitted and would be delivered to recipients shortly.