Networker

Re: [Networker] nsradmin - UNIX

2006-03-15 09:53:41
Subject: Re: [Networker] nsradmin - UNIX
From: "Maarten Boot (CWEU-USERS/CWNL)" <Maarten.Boot AT NL.COMPUWARE DOT COM>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Wed, 15 Mar 2006 15:50:00 +0100
what about:

====================

cat <<! |
. type:nsr client
show name;client id
print
!
nsradmin -i - |
awk '
{
        if( $0 ~ /;$/ ) {
                n = acc $0
                sub(/^[ \t]+/,"",n);
                sub(/[ \t]+$/,"",n);
                sub(/;$/,"",n);
                sub(/[ \t]*:[ \t]*/,":",n)
                print n
                acc = ""
                next;
        }
        if( $0 ~ /\\$/ ) {
                sub(/\\$/,"");
                acc = acc " " $0
                next;
        }
        print
}
END {
         print acc;
}
' |
awk -F: '
/name/ {
        name = $2

}
/client id/ {
        all[name] = $2

}
END {
        for ( i in all ) {
                print i ": " all[i]
        }
} ' |
sort -u

===============================

The first awk deals with continuation lines
and general cleanup of empty space
and prepares for the second awk which handles duplicate client entries 

Maarten

On Wednesday 15 March 2006 14:53, Kathleen wrote:
> In nsradmin I need to print the client name and the client id, but I want
> to send it to a file.  I am using UNIX.  Any suggestion is appreciated.
>
> To sign off this list, send email to listserv AT listserv.temple DOT edu and 
> type
> "signoff networker" in the body of the email. Please write to
> networker-request AT listserv.temple DOT edu if you have any problems wit this
> list. You can access the archives at
> http://listserv.temple.edu/archives/networker.html or via RSS at
> http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

-- 
Maarten Boot, 
Compuware Europe B.V.
Hoogoorddreef 5
1101 BA Amsterdam
Tel: +31 20 312 6511

To sign off this list, send email to listserv AT listserv.temple DOT edu and 
type "signoff networker" in the
body of the email. Please write to networker-request AT listserv.temple DOT edu 
if you have any problems
wit this list. You can access the archives at 
http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

<Prev in Thread] Current Thread [Next in Thread>