-
Notifications
You must be signed in to change notification settings - Fork 66
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
STDIN does not allow to specify the import format. #41
Comments
Maybe it’s a bug. The “i” option can be used for other formats. As a workaround, for tsv format, the “d” option can be used.
I’ll check later. Thank you. |
Surely one can put a filter into the pipe?
el
On 28/01/2021 10:26, Yuki wrote:
Maybe it’s a big. The “i” option can be used for other formats.
As a workaround, for tsv format, the “d” option can be used.
|cat sample.tsv | csvq -d “\t” “select *”|
I’ll check later. Thank you.[...]
--
Dr. Eberhard W. Lisse \ / Obstetrician & Gynaecologist
[email protected] / * | Telephone: +264 81 124 6733 (cell)
PO Box 8421 Bachbrecht \ / If this email is signed with GPG/PGP
10007, Namibia ;____/ Sect 20 of Act No. 4 of 2019 may apply
|
Thank you for your comment. $ cat sample.txt
col1 col2
a b
aaaaaaaaaa b
$ cat sample.txt | csvq -i FIXED -f CSV 'SELECT * FROM STDIN' # '-i FIXED' works as expected.
col1,col2
a,b
aaaaaaaaaa,b
$ cat sample.json
[
{
"col1": "a",
"col2": "b"
},
{
"col1": "aaaaaaaaaa",
"col2": "b"
}
]
$ cat sample.json | csvq -i JSON -f CSV 'SELECT * FROM STDIN' # '-i JSON ' also works as expected.
col1,col2
a,b
aaaaaaaaaa,b
$ cat sample.tsv | csvq -i TSV -f CSV 'SELECT * FROM STDIN' # '-i TSV' is ignored.
col1 col2
a b
aaaaaaaaaa b
$ cat sample.tsv | csvq -d '\t' -f CSV 'SELECT * FROM STDIN' # workaround
col1,col2
a,b
aaaaaaaaaa,b |
This bug has been fixed and the fix is included in the version 1.13.8. |
@ondohotola Sorry, I overlooked that comment. Can you tell me more about what you were concerned about? |
Yuki,
I have no concerns, I was just saying that the issue of not being able
to read TSV from STDINPU can be resolved by way of putting a filter
into the pipe. Something like
cat t.tsv|csvformat -t|csvq 'select * from STDIN'
from csvkit
https://csvkit.readthedocs.io/en/latest/scripts/csvformat.html
or similar :-)-O
Thanks,
el
On 2021-01-31 18:14 , Yuki wrote:
@ondohotola <https://github.com/ondohotola> Sorry, I overlooked that
comment. Can you tell me more about what you were concerned about?
[...]
--
Dr. Eberhard W. Lisse \ / Obstetrician & Gynaecologist
[email protected] / * | Telephone: +264 81 124 6733 (cell)
PO Box 8421 Bachbrecht \ / If this email is signed with GPG/PGP
10007, Namibia ;____/ Sect 20 of Act No. 4 of 2019 may apply
|
@ondohotola |
This is an enhancement request.
The documentation says, "The stdin table loads data from pipe or redirection as a csv data."
I would like to specify the import format for standard input.
The text was updated successfully, but these errors were encountered: