https://github.com/tacahiroy/csvv
A simple CSV extractor that allows you to get columns you want
https://github.com/tacahiroy/csvv
csv golang
Last synced: 2 months ago
JSON representation
A simple CSV extractor that allows you to get columns you want
- Host: GitHub
- URL: https://github.com/tacahiroy/csvv
- Owner: tacahiroy
- License: bsd-3-clause
- Created: 2016-03-29T12:31:10.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-01-16T16:38:02.000Z (about 5 years ago)
- Last Synced: 2024-06-19T04:17:55.828Z (almost 2 years ago)
- Topics: csv, golang
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
csvv
=====
A simple CSV extractor.
Motivation
==========
Sometimes, I need to process too large CSV files from command-line. Needless to say, we have great tools such as `cat`, `sed`, `grep` and `awk`.
```console
cat /path/to/csv-file | awk -F ',' '{ print $2 "," $1 }'
```
However, how I can specify columns by column name, instead of column number like `$1` or `$2`?
Although I didn't google it, I didn't have clear answer(s) to achieve.
So I created csvv.
Installation
============
```console
go get github.com/tacahiroy/csvv
```
Build
=====
```console
go build csvv.go
```
Run
===
```console
csvv /path/to/csv column1,column2[,column3...]
```
Example
=======
Here's a CSV file, say `users.csv`.
```console
id,name,email,github,twitter
1,Bob,bob@aaa.xyz,bobaaa,bob123
2,Jake,jake@aaa.xyz,jakeaaa,jake123
```
If you want to get fields named `id` and `email`, you may run like this:
```console
csvv users.csv id,email
```
Then you get:
```console
id,email
1,bob@aaa.xyz
2,jake@aaa.xyz
```