
September 12th, 2006, 08:42 AM
|
|
Contributing User
|
|
Join Date: Nov 2003
Posts: 127
Time spent in forums: 18 h 48 m 53 sec
Reputation Power: 5
|
|
|
Need help parsing a string
Hi,
I'm writing a shell script that outputs, among other things, some of the information that is outputted by the mysqladmin status command.
The output of the command looks like this:
Uptime: 816351 Threads: 19 Questions: 80719739 Slow queries: 1419 Opens: 15903523 Flush tables: 1 Open tables: 4948 Queries per second avg: 98.879
I need to output the Queries per second, Open tables, and Threads. I know I can count the words on the line and do a cut, but I'd rather do it in a neater fashion.
Is there an easy way to parse this line so that it ouputs:
Uptime: xxxx
Threads: xxx
etc.
and once I have it in that format, I can parse to get the values I want.
Thanks.
|