ltsv2json

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

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

Go to latest
Published: Jun 16, 2018 License: MIT Imports: 7 Imported by: 0

README

LTSV2JSON

convert from LTSV to JSON

Installation

$ go get github.com/hatappi/ltsv2json

Usage

use sample file

stdin

$ cat sample/fruits.ltsv | ltsv2json
[{"name":"apple  num:3"},{"name":"banana num:5"},{"name":"orange num:2"}]

Input File

ltsv2json -i ./sample/fruits.ltsv
[{"name":"apple  num:3"},{"name":"banana num:5"},{"name":"orange num:2"}]

LTSV2JSON has features like tail -f

$ ltsv2json -i ./sample/fruits.ltsv -f
{"name":"apple  num:3"}
{"name":"banana num:5"}
{"name":"orange num:2"}

// another session
$ echo "name:grape\tnum:10" >> sample/fruits.ltsv

// It will be appended
$ ltsv2json -i ./sample/fruits.ltsv -f
{"name":"apple  num:3"}
{"name":"banana num:5"}
{"name":"orange num:2"}
{"name":"grape","num":10}

use jq

$ cat ./sample/fruits.ltsv | ltsv2json |  jq -c '[.[] | .num] | add'
20
$ cat ./sample/fruits.ltsv | ltsv2json | jq -c '.[] | select(.name == "banana") | .num'
5

Contributing

  1. Fork it ( https://github.com/hatappi/ltsv2json/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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