Integrating bash with sql.

Hi Guys,
I m just curious to know whether it is possible to store the output of a shell command to a database .

My main aim is to use a full capacity of sql language to analyze the output generated by shell script.
for example.

by storing the 5 instances of of top at different interval we can simply predict lot of things like.
Which process has Maximum cpu utilization, Which user has maximum processes running.
I think writting a scripts for doing these tasks will require lot of overheads and file creation.

I hope i have clear my point .Please reply if any further clarification is required.

Data such as cpu utilization are transitory, and as such aren't very useful in themselves.
Shell script, and languages such as perl are more than adequate to process simple numbers such as cpu utilization to provide trend data, which can then be stored in a database or indeed flat files for later use. Can you try to explain why you are trying to use SQL in this instance ? Ie, what functionality SQL brings to this task that cannot be accomplished in other ways ?

Thx

MySQL for instance has the commandline mysql tool to execute queries from the commandline. Most major DBMS providers supply something like it.

For example.
Output of top shows process id and amount of CPU consumed by it.
If i write a script for telling the maximum cpu utilization its pretty simple but how would i get something very complex like getting cpu utilization of particular process id over the period .
Group by command and other functions like select max(cpu_uti),process)_id from toptable group by (process id)

This is just a one example with sql you can have lot of options. I guess sqlite is a tool i should go for.

You might also want to investigate sar, available on most Unix implementations (part of the sysstat package in most GNU/Linux distros), which can do per-process accounting with the sadf command.

may be you can try 'isql' command to interact with a database from a shell.

I am sure though.

This can be done by capturing the output of ps command and then storing it in a database table.
I use Perl DBI to store the results and then compute the desired output from it.

I use UNIX95 variable as certain options dont work with ps like -o.

If you need any help on using this , pls post it.