Quantcast
Viewing all articles
Browse latest Browse all 524

How to add consecutive numbers of messages in jq command

I couldn't figure out how to do this, so I asked here.

[  {"message" : "This is","Identity" : "1"  },  {"message" : " a car","Identity" : "2"  },  {"message" : "My Job","Identity" : "11"  },  {"message" : "Is a ","Identity" : "12"  },  {"message" : "Student","Identity" : "13"  }]

1 and 2, 11 and 12 are made up of consecutive numbers.
I would like to group messages made up of consecutive numbers like this and add them starting from the smallest order.
[  {"message" : "This is a car"  },  {"message" : "My Job Is a Student"  }]

I can't remember the mathematical formula, so I would appreciate if you could help me with the formula.

Viewing all articles
Browse latest Browse all 524

Trending Articles