title: Providing a very large argument to a jq command to filter on keys
body: <p>I am trying to parse a very large file which consists of JSON objects like this:</p>
  
  <pre><code>{"id": "100000002", "title": "some_title",  "year": 1988}
  </code></pre>
  
  <p>Now I also have a very big list of ID's that I want to extract from the file, if they are there.</p>
  
  <p>Now I know that I can do this:</p>
  
  <pre><code>jq '[ .[map(.id)|indices("1", "2")[]] ]' 0.txt &gt; p0.json
  </code></pre>
  
  <p>Which produces the result I want, namely fills p0.json with only the objects that have "id" 1 and "2". Now comes the problem: my list of id's is very long too (100k or so). So I have a Python programm that outputs the relevant id's. My line of thought was, to first assign that to a variable:</p>
  
  <pre><code> REL_IDS=`echo python3 rel_ids.py`
  </code></pre>
  
  <p>And then do:</p>
  
  <pre><code>jq --arg ids "$REL_IDS" '[ .[map(.id)|indices($ids)[]] ]' 0.txt &gt; p0.json
  </code></pre>
  
  <p>I tried both with brackets <code>[$ids]</code> and without brackets, but no luck so far. </p>
  
  <p>My question is, given a big amount of arguments for the filter, how would I proceed with putting them into my jq command?</p>
  
  <p>Thanks a lot in advance!</p>