Skip to content
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

Read file list from file #2499

Open
TWiStErRob opened this issue Nov 15, 2022 · 4 comments
Open

Read file list from file #2499

TWiStErRob opened this issue Nov 15, 2022 · 4 comments

Comments

@TWiStErRob
Copy link

Describe the feature
I would like to be able to say jq -s ".[].field" -F files.txt

Expected behavior
Reads the contents of files.txt and loads them as json files. The same as adding all those files as arguments in place of -F files.txt.

Ideally combinable with normal file arguments:
jq -s ".[].field" foo.json bar.json -F files.txt some_*_other.json

Additional context
Similar to this but without the file '...' fluff.

@wader
Copy link
Member

wader commented Nov 15, 2022

Hi, if a shell is available i think you can do something like jq -s ... $(cat files.txt) or cat $(cat files.txt) | jq -s ....

Maybe related PR #1843 (but seems it has stagnated)

@TWiStErRob
Copy link
Author

No wonder, that PR does way too many things...

I'm on Windows, so cat is a no-go (type exists, but subshells don't as far as I know).

I guess type file | xargs jq -s "..." would also work the same. If xargs was available on Windows.

The point of the feature request is that we're not dependent on any shell functionality and quirks and weird syntaxes.

@pkoppstein
Copy link
Contributor

@TWiStErRob - As you may have noticed, development of jq has been in a dormant state for quite some time. You might like to try your luck with some of the jq "clones" or look-alikes -- particularly gojq, but also jaq or jackson-jq.

Are there any others?

In the meantime, have you considered WSL?

@TWiStErRob
Copy link
Author

Yep, WSL works: https://stackoverflow.com/a/74449427/253468

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants