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[])
Process p=Runtime.getRuntime().exec("df -k");
BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
String line=reader.readLine();
how do I grab this information and put it into an array??

catch(IOException e1) {}
catch(InterruptedException e2) {}


You can use String.split() with an appropriate expression to turn that into a String[] array.

Thank you. I was wondering that, but not sure if the df returned as tab delimited... so I am assuming it is??

Give it a quick try. It looks like it to me, but I can't test that here.