I'm struggling to use a single sed command to extract a number from some json on Linux. Given the following block:
{
"key1": 100,
"key2": 200,
}
I'd like the output to be 100 in the above case, but I need to capture it regardless of its length.
So far I've got this:
sed -n '/key1/ s/.*\: //p'
100,
I feel like I should be able to rid myself of the comma without piping out to 'tr' or whatever but I can't seem to manage it.
jq '.key1' file