-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Multi Smaller Files From a Big Json File #3121
Comments
The bad news is that jq alone is not up to the job. The good news is that jq was designed to, and does, work well with other command-line tools. For details, see e.g. https://stackoverflow.com/questions/70569726/jq-split-json-in-several-files |
Thanks buddy. |
@washere wrote:
jq and awk work very well together for the use-case you mention.
Not sure what you're referring to, but please note that jq does support (nested) regex groupings by name, e.g.
Since these jqlang "issues" pages are mainly for reporting bugs and requesting enhancements, we generally ask that usage questions and the like be posted to https://stackoverflow.com/questions/tagged/jq where you'll likely get timely and useful responses. If you have a specific ER to make, by all means do so; otherwise, please consider closing this "issue". |
Thanks. I deleted 1st line of each note (.db primary key) by regexp grouping (need to click regexp icon next to find/replace fields):
.* is whatever renamed category:
/1 being whatever .* So ended up with 3 lines per note. Then just used:
ie: create a new file called Note-xxx from every 3 lines (-l 3). It worked great. Although this can be a label (Support or Feature Request), I agree with you so closing this. |
In case anyone in future needs this: Because all note content is in a line (single field (cell) of SQLite table (Row for each record) before exportimg to JSON), there will be lots of: \n 2 problems exist, to change them into actual New_Lines (Carriage Returns):
The trick with the latter is to have triple back slashes:
ABOVE commands operate on ALL FILES in the directory you're in (pwd). Then notes look nice, good luck. P.S. make sure in terminal you are in the folder where all the files are, saves typing path in commands. Just paste the whole chunk in a terminal & return to run it:
This line: P.P.S.: https://regexxer.sourceforge.net/ https://mail.gnome.org/archives/gnome-announce-list/2004-July/msg00022.html |
If a JSON file format is like this, example of first 2 notes:
Can we have each as a separate file, so this would be the first txt file:
and so on for all notes. Is it possible to do this in jq or am I wasting my time?
Thanks.
The text was updated successfully, but these errors were encountered: