I'm trying to produce multiple output files from a large JSON file of many objects which can be identified by $var1.
My 'application' splits arrays within each json object into multiple rows of text which I can test with awk to get records within a period.
From a long list of $var1, and fixed $unixtime1 and $unixtime2 for a single pass, what would a bash FOR loop look like that would pass in these variables?
cat data.json | grep $var1 | application | awk -F '$10 > $unixtime1 && $10 < $unixtime2' > $var1.txt
I could use jq to obtain a list of var1, but cannot use jq for the entire operation because of some jq limitations with large integers.
jq -c .var1 data.json | sort | uniq -c
As an occasional procedure, I've chosen not to modify my 'application' for the task (yet) - but I appreciate the experienced expertise out there.
The following for loop does the first bit - But how do I introduce the timestamps as variables?
test.txt
351779050870307
351889052023932
#! /usr/bin/env bash
for i in `cat test.txt`
do
cat data.json | grep $i | application | awk -F "\"*,\"*" '$10 > 1417251600000 && $10 < 1417338000000' > $i.txt
done