OK This is my solution to extract the information
function readTextFile(file_name)
{
var file = new XMLHttpRequest();
file.open("GET", file_name, false);
file.onreadystatechange = function ()
{
if(file.readyState === 4)
{
if(file.status === 200 || file.status == 0)
{
allText = file.responseText;
document.write(allText+"<BR>");
}
}
}
file.send(null);
}
function processTextValue()
{
var in_arr = ['PROTO', 'TTL', 'TOS', 'ID', 'IpLen', 'DgmLen'];
for(var i=0; i<in_arr.length; i++)
{
var c = in_arr[i];
var n = allText.indexOf(c);
var m = allText.indexOf(" ", n);
n = n+c.length+1;
document.write(c+": "+allText.substr(n, m-n)+"<BR>");
}
}
readTextFile('your_file.txt');
processTextValue();
This is the result:
PROTO: 255
TTL: 0
TOS: 0x0
ID: 62399
IpLen: 20
DgmLen: 165