Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl # use strict; use warnings; local $_ = do { local $/; <DATA> }; my %results; # match two lines at a time $results{$1}{$5}{$2}{$3} = $4 while /^(\S+):\s+ static-route\s(\S+)\s next-hop\s(\S+) (?:\spreference\s\d+)? (?:\sbfd-enable)?\s tag\s(\d ++) \n \1-\s* service-name\s"(\S+)"/gmx; for my $box (sort keys %results) { print "\n$box\n"; for my $service (sort keys %{$results{$box}}) { for my $static (sort keys %{$results{$box}{$service}}) { for my $hop (sort keys %{$results{$box}{$service}{$static}}) { print "$static\t next-hop $hop\t", "tag $results{$box}{$service}{$static}{$hop}, service $servi +ce\n"; } } } } __DATA__ dnsname1: static-route next-hop preferen +ce 200 bfd-enable tag 685 dnsname1- service-name "XYZ12345-s12345" dnsname2: static-route next-hop bfd-enab +le tag 635 dnsname2- service-name "XYZ67891-s67890"


dnsname1 next-hop tag 685, service XYZ12345-s123 +45 dnsname2 next-hop tag 635, service XYZ67891-s678 +90

In reply to Re: Store multiple lines by tybalt89
in thread Store multiple lines by bartrad

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (4)
    As of 2020-10-22 10:24 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (225 votes). Check out past polls.