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

cut command not working with this .csv file #65

Closed
vapniks opened this issue Sep 8, 2015 · 10 comments
Closed

cut command not working with this .csv file #65

vapniks opened this issue Sep 8, 2015 · 10 comments

Comments

@vapniks
Copy link
Contributor

vapniks commented Sep 8, 2015

Using the latest miller release (v2.1.4.tar.gz, although mlr --help reports v2.1.3.).
The command: mlr --csv cut -f country wbdata.csv produces no output where wbdata.csv contains the following data:

iso2c,country,year,MS.MIL.XPND.GD.ZS,NE.CON.TETC.ZS,UIS.XGDP.FSGOV.FDINSTADM.FFD,NY.GDP.MKTP.KD.ZG,SH.XPD.PUBL.ZS,IE.ICT.TOTL.GD.ZS,IE.PPI.TRAN.CD,GB.XPD.DEFN.CN,GB.XPK.INLD.CN
CM,Cameroon,1980,NA,78.2638039227086,NA,-1.96529166883707,NA,NA,NA,NA,73240002560
CM,Cameroon,1981,NA,79.3593625984257,NA,17.082682248754,NA,NA,NA,NA,153900007420
CM,Cameroon,1982,NA,70.9004012667756,NA,7.51620260553753,NA,NA,NA,NA,234499997700
CM,Cameroon,1983,NA,72.928138593501,NA,6.86683056611426,NA,NA,NA,NA,267699994620
CM,Cameroon,1984,NA,71.5711709053482,NA,7.47457254301733,NA,NA,NA,NA,274299994110
CM,Cameroon,1985,NA,73.2420993013362,NA,8.06316167187164,NA,NA,NA,NA,425999990780
CM,Cameroon,1986,NA,73.9302317635993,NA,6.77166308049775,NA,NA,NA,NA,470999990270
CM,Cameroon,1987,NA,79.2320191357579,NA,-2.14665021191912,NA,NA,NA,NA,694999973890
CM,Cameroon,1988,1.26160386177472,79.0313468274156,NA,-7.82363197506437,NA,NA,NA,NA,283000012800

If I replace country with any other column name I still get no output.
Am I doing something wrong? It seems to work OK with another .csv file I tried, but not this one.

Furthermore, if I try piping the data to miller like this: cat wbdata.csv | mlr --csv cut -f country I get the following error:

fopen: No such file or directory
mlr: Couldn't fopen "-" for read.
@johnkerl
Copy link
Owner

johnkerl commented Sep 8, 2015

I'll check out the country issue. I'll add your data as a UT case.

The fopen was fixed in a recent commit. There was a missing UT case for that; there will now be.

Thank you!

@johnkerl
Copy link
Owner

johnkerl commented Sep 8, 2015

Is the file CRLF-terminated?

@vapniks
Copy link
Contributor Author

vapniks commented Sep 8, 2015

No, it's a standard linux text file

@johnkerl
Copy link
Owner

johnkerl commented Sep 8, 2015

#50

@johnkerl
Copy link
Owner

johnkerl commented Sep 8, 2015

#50 addresses this.

It's not an ideal situation. 1st prio right now is ./configure support, then #50. Crazy week this week but likely I'll get on #50 this weekend.

@johnkerl johnkerl closed this as completed Sep 8, 2015
@vapniks
Copy link
Contributor Author

vapniks commented Sep 8, 2015

Thankyou! Great work btw, very useful!

@johnkerl
Copy link
Owner

johnkerl commented Sep 8, 2015

Glad to hear it!! :)

@johnkerl
Copy link
Owner

johnkerl commented Sep 8, 2015

P.S. there is a termcvt in the c/Makefile you can use for line-term conversions, if you like.

@vapniks
Copy link
Contributor Author

vapniks commented Sep 8, 2015

would unix2dos work?

@johnkerl
Copy link
Owner

johnkerl commented Sep 8, 2015

Sure, if your platform has it.

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

2 participants