'Exclude column from jq json output

I would like to get rid of the timestamp field here using jq JSON processor.

[
  {
    "timestamp": 1448369447295,
    "group": "employees",
    "uid": "elgalu"
  },
  {
    "timestamp": 1448369447296,
    "group": "employees",
    "uid": "mike"
  },
  {
    "timestamp": 1448369786667,
    "group": "services",
    "uid": "pacts"
  }
]

White listing would also works for me, i.e. select uid, group

Ultimately what I would really like is a list with unique values like this:

employees,elgalu
employees,mike
services,pacts


Solution 1:[1]

For the record, an alternative would be:

$ jq -r '.[] | "\(.uid),\(.group)"' input.json

(The white-listing approach makes it easy to rearrange the order, and this variant makes it easy to modify the spacing, etc.)

The following example may be of interest to anyone who wants safe CSV (i.e. even if the values have embedded commas or newline characters):

$ jq -r '.[] | [.uid, .group] | @csv' input.json
"elgalu","employees"
"mike","employees"
"pacts","services"

Solution 2:[2]

Sed is your best friend - I can't think of anything simpler. I've got here having the same problem as the question's author - but maybe this is a simpler answer to the same problem:

< file sed -e '/timestamp/d'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 peak
Solution 2 ouflak