I was trying to extract value of g1 and p1 only inside the tags where t1 is "Reading C (bytes)" and comparing them to make sure p1 is always less than g1. Here is the Json file I'm using -
File:-
{
"g1" : 1482568,
"n1" : "v_4",
"p1" : 0,
"s1" : "RC",
"t1" : "LM",
}
{
"g1" : 1482568,
"n1" : "v_4",
"p1" : 1482568,
"s1" : "RC",
"t1" : "LM",
}
{
"g1" : 1482568,
"n1" : "v_4",
"p1" : 0,
"s1" : "RC",
"t1" : "Reading C (bytes)",
}
{
"g1" : 1482568,
"n1" : "v_4",
"p1" : 1282568,
"s1" : "RC",
"t1" : "Reading C (bytes)",
}
{
"g1" : 1482568,
"n1" : "v_4",
"p1" : 1482568,
"s1" : "RC",
"t1" : "Reading C (bytes)",
}
{
"g1" : 543278,
"n1" : "v_4",
"p1" : 0,
"s1" : "RC",
"t1" : "LV",
}
{
"g1" : 1482568,
"n1" : "v_4",
"p1" : 0,
"s1" : "RC",
"t1" : "LM",
}
I was trying using simple shell scripting to extract the line number of starting and ending t1 and computing the difference. Could you please assist awk to simply extracting the values and comparing g1 and p1 regardless of b number of tags using t1 = Reading C (bytes)
Thanks