linux - java remove first line from exec command output -
relate first question @ execute linux command in java , display output html table have manage work, still have 1 other question: how can remove first line output? below code:
<% string[] disk; string line; string process; process p; bufferedreader input; p = runtime.getruntime().exec("df -h"); input = new bufferedreader(new inputstreamreader(p.getinputstream())); %> <tr bgcolor="#f0f0f0"> <td> <b>disk</b> </td> <td> <b>size</b> </td> <td> <b>used</b> </td> <td> <b>avail</b> </td> <td> <b>use %</b> </td> <td> <b>mounted</b> </td> <td> </td> </tr> <% while ((line = input.readline()) != null) { disk = line.split("\\s+"); %> <tr> <td><% out.println(disk[0]); %></td> <td><% out.println(disk[1]); %></td> <td><% out.println(disk[2]); %></td> <td><% out.println(disk[3]); %></td> <td><% out.println(disk[4]); %></td> <td><% out.println(disk[5]); %></td> </tr> <% } input.close(); %>
the output like:
what want remove filesystem size used avail use% mounted
showing after table header.
read 1 line before while
loop, adding line before loop:
input.readline();
Comments
Post a Comment