title: JQ 'select' or 'if'?
body: <p>I have a JSON file:</p>
  
  <pre><code>{
    "StatusInfos": null,
    "ReadReplicaSourceDBInstanceIdentifier": null,
    "DBInstanceIdentifier": "test1"
  }
  {
    "StatusInfos": null,
    "ReadReplicaSourceDBInstanceIdentifier": null,
    "DBInstanceIdentifier": "test2"
  }
  {
    "StatusInfos": [
      {
        "Status": "replicating",
        "StatusType": "read replication",
        "Normal": true
      }
    ],
    "ReadReplicaSourceDBInstanceIdentifier": "test1",
    "DBInstanceIdentifier": "read-rep-test1"
  }
  {
    "StatusInfos": [
      {
        "Status": "replicating",
        "StatusType": "read replication",
        "Normal": true
      }
    ],
    "ReadReplicaSourceDBInstanceIdentifier": "test2",
    "DBInstanceIdentifier": "read-rep-test2"
  }
  </code></pre>
  
  <p>I'm trying to produce:</p>
  
  <pre><code>{
    "StatusInfos": null,
    "ReadReplicaSourceDBInstanceIdentifier": null,
    "DBInstanceIdentifier": "test1"
  }
  {
    "StatusInfos": null,
    "ReadReplicaSourceDBInstanceIdentifier": null,
    "DBInstanceIdentifier": "test2"
  }
  {
    "RepStatus": "replicating",
    "RepStatusType": "read replication",
    "ReadReplicaSourceDBInstanceIdentifier": "test1",
    "DBInstanceIdentifier": "read-rep-test1"
  }
  {
    "RepStatus": "replicating",
    "RepStatusType": "read replication",
    "ReadReplicaSourceDBInstanceIdentifier": "test2",
    "DBInstanceIdentifier": "read-rep-test2"
  }
  </code></pre>
  
  <p>I have tried dozens of variations of 'select' and 'if', most of which simply spit out errors.  My most recent attempt (I'm limited to jq 1.3 if that is important) produces neither errors nor output:</p>
  
  <pre><code>   cat json_file |
        jq -r '{ DBInstanceIdentifier,
                 ReadReplicaSourceDBInstanceIdentifier
               } +
               ( select( .StatusType == "read replication" ) |
                .StatusInfos[] | { RepStatusType: .StatusType, RepStatus: .Status }
               )'
  </code></pre>
  
  <p>JQ is absolutely baffling to me.  I have referenced the manuals many times, but they give examples, not principles.  So in addition to how to solve my immediate problem, if you can recommend how I might go about actually understanding JQ, I would appreciate it.</p>