I do post processing with perl to get the \'s out
20 sub get_notifications ()
21 {
# @a builds the command
22 my @a = (
23 "option hidden",
24 ". type: nsr client",
25 "show name;owner notification",
26 "print",
27 );
28
# create the temp file with the command for nsradmin
29 my $f = mk_tmpf(@a);
30 my $cmd = "nsradmin -i $f";
31
# here we run the command
32 open(IN, "$cmd |") || die "FATAL: cannot start '$cmd', $!";
33 my $p = 0;
34 my $a = undef;
35 my $node = undef;
36 my @list = ();
37
38 while(<IN>) {
39 # skip all data before the result set gets printed
40 if( $p == 0 && /current query set/i ) {
41 $p = 1;
42 next;
43 }
44 next unless $p;
45
46 s/^\s+//;
47 s/\s+$//; # this also deletes the trailing newline
48
49 # here we are processing the result set
50 # watch out for continuation lines
51
52 if( m/\\$/ ) {
53 s/\\$//; # delete the continuation marker
54 if( defined $a ) {
55 $a = $a . $_; # append the current line to the
accumulator
56 } else {
57 $a = $_; # set the accumulator
58 }
59 next; # dont print now , remember the line
for now
60 }
61
62 # when we are processing lines see
63 # if the accumulator contains data
64 # and prepend it to the current line
65 if( defined $a ) {
66 $_ = $a . $_;
67 # now that we have used the accumulator we must! reset it
to undef
68 $a = undef;
69 }
70
71 # process name, value pairs
# here we have no continuation lines anymore
# just name: value;
# name ends with :
# value ends with ;
Maarten
On Friday 16 December 2005 09:56, Antonio Ettorre wrote:
> Yes, right, but without send an email, i try to explain better my pourpose,
> using nsradmin, i have an output like this:
>
> nsradmin> show completion
> nsradmin> print
> name: FMS-OS;
> completion: client-bk, /, "succeeded:incr:save",
> " client-bk: / level=incr, 4286 KB 00:01:42 984
> fi\ les",
> client-bk, /stand, "succeeded:incr:save",
> " client-bk: /stand level=incr, 15 KB 00:01:38 20
> fi\ les",
> client-bk, /var, "succeeded:incr:save",
> " client-bk: /var level=incr, 216 MB 00:01:53 11587
> fi\ les",
> client-bk, /var/adm/crash,
> "succeeded:incr:save",
> " client-bk: /var/adm/crash level=incr, 4 KB 00:01:38 5
> fi\ les",
> client-bk, /usr, "succeeded:incr:save",
> " client-bk: /usr level=incr, 1598 KB 00:00:03 1595
> fi\ les",
> client-bk, /tmp, "succeeded:incr:save",
> " client-bk: /tmp level=incr, 63 KB 00:00:03 39
> fi\ les",
> client-bk, /opt, "succeeded:incr:save",
> " client-bk: /opt level=incr, 9789 KB 00:00:10 4185
> fi\ les",
> client-bk, /home, "succeeded:incr:save",
> " client-bk: /home level=incr, 19 MB 00:00:04 113
> fi\ les",
> client-bk, /app, "succeeded:incr:save",
> " client-bk: /app level=incr, 2711 KB 00:00:09 2828
> fi\ les",
> client-bk, index, "succeeded:9:index",
> " server-bk: index:client-bk level=9, 27 MB 00:00:51 40 fi\
> les";
>
> I would know if it is possible to don't have the \ at the end of line,in
> the example i have the word files changed in fi\les ....
> can i change this behaiovur?
>
> Antonio
>
> 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
|