Gee is tool of stdin to each files and stdout. It is similar to the tee command, but there are more functions for convenience. In addition, it was written as go. which provides output to stdout and files. In this process, it has various processing functions for lines such as replace, prefix, and suffix, so it can be used as a pipeline configuration or as a utility for testing. For more information, see the usage and case of study below!

? Installation

from source

▶ GO111MODULE=on go get -v

with homebrew

▶ brew tap hahwul/gee
▶ brew install gee

☄️ Usage

▶ ~/go/bin/gee -h (if you install from source)
▶ gee -h
Usage: ./gee [flags] [file1] [file2] ...
(If you do not specify a file, only stdout is output)

    	Append mode for files
  -chunked int
    	Chuked files from line (e.g output / output_1 / output_2)
    	Show debug message!
    	Distribution to files
  -find string
    	Find string in line (colorize red)
  -format string
    	Change output format (json, md-table, html-table) (default "line")
  -grep string
    	Greping with Regular Expression (like grep)
  -grepv string
    	Inverse greping with Regular Expression (like grep -v)
  -prefix string
    	Prefix string
  -replace string
    	Replace string in line with '-find' option
    	Remove newline(\r\n)
  -split string
    	Split string within line. (to line , to table, to md-table)
  -suffix string
    	Suffix string
    	Uncolorize stdout
    	Version of gee
    	With line number (colorize blue)
    	With timestamp (colorize green)

? Case of Study

gee with prefix and suffix

▶ cat urls | gee -prefix "curl -i -k " -suffix " -H 'Auth: abcd'"
curl -i -k -H 'Auth: abcd'
curl -i -k -H 'Auth: abcd'
curl -i -k  -H 'Auth: abcd'

Find and replace

▶ cat raw.txt | gee -find keep-alive
▶ cat raw.txt | gee -find keep-alive -replace close

Specify the maximum length of the file and save it in multiple files.

▶ wc -l http.txt

▶ cat http.txt | gee -chunked 500 output

Distribute each line sequentially to multiple files.

▶ wc -l http.txt

▶ cat http.txt | gee -distribute alice.txt bob.txt charlie.txt