gsv

command module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: MIT Imports: 10 Imported by: 0

README

= gsv
:sectnums:
:toc: left

image:https://github.com/jiro4989/gsv/actions/workflows/go-test.yml/badge.svg[test, link="https://github.com/jiro4989/gsv/actions/workflows/go-test.yml"]
image:https://codecov.io/gh/jiro4989/gsv/branch/main/graph/badge.svg[codecov, link="https://codecov.io/gh/jiro4989/gsv"]

`gsv` transforms a multi-line CSV into one-line JSON to make it easier to `grep`.
`gsv` is heavily inspired by https://github.com/tomnomnom/gron[gron].

[source,bash]
----
⟩ cat testdata/sample1.csv
Language,Word,Note
English,"Hello
World",note
Japanese,"こんにちは
こんばんは",メモ
English,"John
Rose",
Japanese,"太郎
花子",

⟩ cat testdata/sample1.csv | ./gsv
["Language","Word","Note"]
["English","Hello\nWorld","note"]
["Japanese","こんにちは\nこんばんは","メモ"]
["English","John\nRose",""]
["Japanese","太郎\n花子",""]

⟩ cat testdata/sample1.csv | ./gsv | grep Japan
["Japanese","こんにちは\nこんばんは","メモ"]
["Japanese","太郎\n花子",""]

⟩ cat testdata/sample1.csv | ./gsv | grep Japan | ./gsv -u
Japanese,"こんにちは
こんばんは",メモ
Japanese,"太郎
花子",
----

== Usage

[source,bash]
----
gsv <csv_file> | grep '<pattern>' | gsv -u
----

== Installation

[source,bash]
----
go install github.com/jiro4989/gsv@main
----

or download executables from https://github.com/jiro4989/gsv/releases[GitHub Releases].

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