grep command in c?????
hi ,
I want to redirect output of a c program in other c program.
Here i want to use grep command in c to filter the output to the desired.
Can i do it?
I will be more clear.
I want a command to run and then the output to be redirected .
if i run the command, , i will get the details about the hard disk.
But i just want the output to be Serial number and all that is not needed.
So, i am planning to use grep command to rediract that output.
so, i have written a c program like this:
System("/sbin/hdparm -i /dev/hda ")
This will get the entire details.
now, the command,/sbin/hdparm -i /dev/hda | grep "Serial Number" will give me just the serial number of the hard disk.
For this , i want to use grep with a pipe in c program.
I tried it in "System". It didint work out.
Is there any possibility that i can use grep command in c.
????
Need help.
Looking forward for reply..
Narasimha
|