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

About specifying input and output format #199

Closed
aborruso opened this issue Oct 23, 2018 · 4 comments
Closed

About specifying input and output format #199

aborruso opened this issue Oct 23, 2018 · 4 comments

Comments

@aborruso
Copy link
Contributor

aborruso commented Oct 23, 2018

Hi,
I'm a basic user of mlr and I'm becoming mad for stupid thing: specifying input and (especially) output format.

If I run

echo '[{"name":"tom","age":22},{"name":"bianca","age":34}]' | mlr --json --csv cat

I have an error, because I must write --ocsv for output. I lost (I'm stupid :) ) a lot of minutes to figure out how to correct the above command, for two reasons:

  • it's not mandatory to specify i and than --ijson for input (it works in both ways). Than for me it had to be the same also for output and I was looking for syntax errors only in the input file and not in the command. For me --csv had to be ok;
  • I think that - I could be wrong - that there is not in documentation a sentence like "to specify the output format prepend --o to the format name (i.e. --ocsv, --ojson, etc.) and optionally prepend --i for input one". I think it would be good to have it

Probably the right way is to add dedicated section in the documentation, because mlr option for input and output are many:

  • mlr --ijson cat input.json, to set the input as json and to have the default output;
  • mlr --json cat input.json, to set the input and output as json;
  • mlr --ijson --ocsv cat input.json, to set the input as json and to have csv output;
  • mlr --json --ocsv cat input.json, to set the input as json and to have csv output;
  • mlr --j2c cat input.json, to set the input as json and to have csv output;
  • echo "name=tom,age=22\nname=bianca,age=34" | mlr --ocsv cat, to set csv as output and use the default input format;

Thank you

@johnkerl
Copy link
Owner

Thanks, I will definitely write this up as an FAQ!

Additionally:

@johnkerl
Copy link
Owner

johnkerl commented Dec 9, 2018

http://johnkerl.org/miller-releases/miller-head/doc/reference.html#Formats

@johnkerl johnkerl closed this as completed Dec 9, 2018
@johnkerl
Copy link
Owner

johnkerl commented Dec 9, 2018

fbef04e

831cdd7

@aborruso
Copy link
Contributor Author

aborruso commented Dec 9, 2018

thank you

@johnkerl johnkerl removed the active label Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants