Skip to content

jiro4989/tinyutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinyutils

tinyutils are minimum commands.

Developing now

1. Development

% go version
go version go1.12 linux/amd64

2. Usage

2.1. flat

Flats input streams.

$ seq 5 | flat
1 2 3 4 5

$ seq 5 | flat -n 2
1 2
3 4
5

$ seq 5 | flat -d ,
1,2,3,4,5

2.2. rep

Repeat input stream.

$ rep 5 A
AAAAA

$ echo 'A B' | rep 5 -i
A BA BA BA BA B

$ rep 1 3 5 A
A
AAA
AAAAA

$ rep $(seq 5) A
A
AA
AAA
AAAA
AAAAA

% rep 5 5 5 5 A -d ,
A,A,A,A,A
A,A,A,A,A
A,A,A,A,A
A,A,A,A,A

2.3. ucut

Unicode cut.

$ echo 1あ2あ3 | ucut -d あ -f 1,2
1 2

$ echo 1,2,3,4,5 | ucut -d , -f 1,3,5
1 3 5

$ echo 1,2,3,4,5 | ucut -d , -f 1,3-
1 3 4 5

$ echo 1,2,3,4,5 | ucut -d , -f 2-4
2 3 4

$ echo 1,2,3,4,5 | ucut -d , -f 1,3-5
1 3 4 5

$ echo 1,2,3,4,5 | ucut -d , -f 1,2,1,2,3-
1 2 1 2 3 4 5

2.4. codepoint

Prints code point.

% echo あいうえお | codepoint
char code_point code_point(hex)
あ 12354 \U3042
い 12356 \U3044
う 12358 \U3046
え 12360 \U3048
お 12362 \U304a

3. Install

go get github.com/jiro4989/tinyutils/cmd/...

# or

GO111MODULE=off go get github.com/jiro4989/tinyutils/cmd/...

or

Download binary from Releases.

4. License

MIT

Releases

No releases published

Packages

No packages published