단일 단어 또는 여러 단어를 검색하여 전체 단락 가져오기

단일 단어 또는 여러 단어를 검색하여 전체 단락 가져오기

스크립트 부분에 도움이 필요합니다.

아래와 같이 라우터에 대한 구성 파일이 있습니다.

# 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 또는 기타 도구를 사용할 수 있나요?

귀하의 도움에 크게 감사하겠습니다. 감사해요.

관련 정보