単一の単語または複数の単語を検索して段落全体を取得する

単一の単語または複数の単語を検索して段落全体を取得する

スクリプト部分に助けが必要です。

以下に示すように、ルータの設定ファイルがあります。

# TiMOS-C-16.0.R5-1 cpm/hops64 Nokia 7750 SR Copyright (c) 2000-2019 Nokia.

# All rights reserved. All use subject to applicable license agreements.

# Built on Fri Jan 18 10:59:23 PST 2019 by builder in /builds/c/160B/R5-1/panos/main


# Generated MON SEP 30 08:06:41 2019 UTC

exit all
configure
#--------------------------------------------------
echo "System Configuration"
#--------------------------------------------------
    system
        name "iLAB-SR-12-R2"
        ptp
            profile g8275dot1-2014
            clock-type boundary
        exit
        rollback
            rollback-location "cf3:/rollback"
        exit
        snmp
            streaming
                no shutdown
            exit
            packet-size 9216
        exit
        software-repository "SAS-Sx-image" create
            description "Ethernet Satellite SW rep"
            primary-location "cf3:\images\7210-SAS-Sx-TiMOS-10.0.R10"
        exit
        time
            ntp
                ntp-server authenticate
                authentication-key 1 key "9MwhaEG2ryE/jYWFp7Sa64ypYoc=" hash2 type message-digest
                no shutdown
            exit
            sntp
                shutdown
            exit
            zone SGT 08
        exit

#--------------------------------------------------
echo "System Time NTP Configuration"
#--------------------------------------------------
    system
        time
            ntp
                server ptp prefer
                server 129.250.35.251
            exit
        exit
    exit

したがって、ほとんどのルータには上記の設定ファイルがあります。

今、いくつかの主要なブロックファイルがあります。

time
    ntp
        ntp-server authenticate
        authentication-key 1 key "9MwhaEG2ryE/jYWFp7Sa64ypYoc=" hash2 type message-digest
        no shutdown
    exit
    sntp
        shutdown
    exit
    zone SGT 08
exit

ptp
    profile g8275dot1-2014
    clock-type boundary
exit


    system
        login-control
            idle-timeout 60
        exit
    exit


system
    time
        ntp
            server ptp prefer
            server 129.250.35.251
        exit
    exit
exit

したがって、すべての重要なブロックファイルがルータ設定にあることを確認するために、ルータ設定ですべての重要なブロックファイルを確認したいと思います。

ついています。誰でも解決策を提供できますか? awk、sed、grep、または他のツールを使用できますか?

ご協力ありがとうございます。ありがとうございます。

ベストアンサー1

おすすめ記事