csvmagi

command module
v0.0.0-...-b6f4a9c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 8 Imported by: 0

README

Run

$ go run github.com/adzeitor/csvmagi "This is column foo {foo} and column bar {bar}" < file.csv

Also you can use column numbers using special variables {_1}, {_2}, etc in template:

$ go run github.com/adzeitor/csvmagi 'UPDATE some_table SET foo="{_2}" WHERE id="{_1}"'< file.csv

In strict mode you receive errors on undefined columns:

$ go run github.com/adzeitor/csvmagi -strict 'Some of the last columns {_999}' < file.csv

Changing delimiter is also supported:

$ go run github.com/adzeitor/csvmagi -delimiter ';' '{_1} | {_2}' < file.csv

For files without header use -noheader argument:

$ go run github.com/adzeitor/csvmagi -noheader '{_1} | {_2}' < file.csv

Limitations:

  • only support CSV files with headers

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL