I am attempting to execute a unix "df -k" command in java. I have the following example.. My question is how do I parse the results of the command in order to grab the available bytes versus just printing it out????
import java.io.*;
public class unixcmd
{
public static void main(String args[])
{
try
{
Process p=Runtime.getRuntime().exec("df -k");
p.waitFor();
BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
String line=reader.readLine();
while(line!=null)
{
System.out.println(line);
line=reader.readLine();
how do I grab this information and put it into an array??
}
}
catch(IOException e1) {}
catch(InterruptedException e2) {}
System.out.println("Done");
}
}