4 ms·
To be fair, sometimes calling some giant java library or installing tons of dependencies is just not realistic. Use the library for the mission critical stuff
by SanchoPanda 6y ago
To be fair, sometimes calling some giant java library or installing tons of dependencies is just not realistic. Use the library for the mission critical stuff or the automated reporting without a doubt, but it's important to be practical and thinking on your feet as well.
In the meantime for quick analysis and testing 90% + can be accomplished with one line of (g)awk.
awk -v FPAT='"[^"]*"|[^,]*' -v OFS='\t' '{$1=$1; print $0}' "$filename"
More on FPAT [here](https://www.gnu.org/software/gawk/manual/gawk.html#Splitting-By-Content https://www.gnu.org/software/gawk/manual/gawk.html#Splitting...)
- nicoburns 6y agoYou can also use xsv for this kind of analysis of CSV files. Which is a unix-style tool designed for CSVs and with a proper CSV parser. It's written in Rust so it's one binary - no runtime dependencies, and will happily chunk through multi-gigabyte files. https://github.com/BurntSushi/xsv https://github.com/BurntSushi/xsv