Hirdetés

Keresés

Új hozzászólás Aktív témák

  • crok

    Topikgazda

    válasz Rocko007 #4732 üzenetére

    Cisco összehasonlító az RV szériában, egészen jó árban vannak..

    Más: bash-ben kellene nekem olyan, mint a "show run | section xyz".
    Egyelőre ilyet találtam ki, elég pharaszt meg nincs kivételkezelés,
    meg csak annyi, hogy első egyező sortól követjező betűvel (nem
    space-el..) kezdődő sorig kiír minden sort:

    #!/bin/bash
    FIRST=$(echo $1 | sed 's,/,\\/,g')
    SECOND=$(echo $2 | sed 's,/,\\/,g')
    THIRD=$(echo $3 | sed 's,/,\\/,g')
    FOURTH=$(echo $4 | sed 's,/,\\/,g')
    sed -n '/'^"$FIRST".*"$SECOND".*"$THIRD".*"$FOURT"'/,/^[a-z]/p' | sed '$d'

    Ilyen működés közben:
    [crok@clifford ~]$ cat temp/1.txt | s int fa 0/0
    interface FastEthernet0/0
    description WAN
    ip address 172.16.0.100 255.255.255.0
    ip access-group no_LAN_IP_from_WAN in
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip accounting output-packets
    ip accounting mac-address input
    ip accounting mac-address output
    ip nbar protocol-discovery
    ip nat outside
    ip virtual-reassembly
    zone-member security PUBLIC
    ip route-cache flow
    duplex auto
    speed auto
    no shut
    [crok@clifford ~]$ cat temp/1.txt | s int fa 0/1
    interface FastEthernet0/1
    description LAN
    ip address 10.10.10.1 255.255.255.0
    ip access-group LAN in
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip accounting output-packets
    ip accounting mac-address input
    ip accounting mac-address output
    ip nbar protocol-discovery
    ip nat inside
    ip virtual-reassembly
    zone-member security LAN
    ip route-cache flow
    duplex auto
    speed auto
    arp probe interval 10 count 3
    arp authorized
    arp timeout 3600
    no shut

Új hozzászólás Aktív témák