parsing question
Mag Gam
magawake at gmail.com
Mon May 31 09:42:04 EDT 2010
I have a file with bunch of nfsstat -c (on AIX) which has all the
hostnames, for example
========r1svr==========
Client rpc:
Connection oriented
calls badcalls badxids timeouts newcreds badverfs timers
0 0 0 0 0 0 0
nomem cantconn interrupts
0 0 0
Connectionless
calls badcalls retrans badxids timeouts newcreds badverfs
6553 0 0 0 0 0 0
timers nomem cantsend
0 0 0
Client nfs:
calls badcalls clgets cltoomany
6541 0 0 0
Version 2: (6541 calls)
null getattr setattr root lookup readlink read
0 0% 590 9% 414 6% 0 0% 2308 35% 0 0% 0 0%
wrcache write create remove rename link symlink
0 0% 2482 37% 276 4% 277 4% 147 2% 0 0% 0 0%
mkdir rmdir readdir statfs
6 0% 6 0% 30 0% 5 0%
Version 3: (0 calls)
null getattr setattr lookup access readlink read
0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
write create mkdir symlink mknod remove rmdir
0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
rename link readdir readdir+ fsstat fsinfo pathconf
0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
commit
0 0%
========r2svr==========
Client rpc:
Connection oriented
calls badcalls badxids timeouts newcreds badverfs timers
0 0 0 0 0 0 0
nomem cantconn interrupts
0 0 0
Connectionless
calls badcalls retrans badxids timeouts newcreds badverfs
6553 0 0 0 0 0 0
timers nomem cantsend
0 0 0
Client nfs:
calls badcalls clgets cltoomany
6541 0 0 0
Version 2: (6541 calls)
null getattr setattr root lookup readlink read
0 0% 590 9% 414 6% 0 0% 2308 35% 0 0% 0 0%
wrcache write create remove rename link symlink
0 0% 2482 37% 276 4% 277 4% 147 2% 0 0% 0 0%
mkdir rmdir readdir statfs
6 0% 6 0% 30 0% 5 0%
Version 3: (0 calls)
null getattr setattr lookup access readlink read
0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
write create mkdir symlink mknod remove rmdir
0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
rename link readdir readdir+ fsstat fsinfo pathconf
0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
commit
0 0%
and so on...
(http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.prftungd/doc/prftungd/nfsstat_c_command.htm)
Is there a an easy way to parse this file according to each host?
So,
r1svr.Connectionless.calls=6553
r1svr.Connectionless.badcalls=0
and so on...
I am currently using awk which I am able to get what I need, but
curious if in python how people handle block data.
More information about the Python-list
mailing list