split-tk

Crates.iosplit-tk
lib.rssplit-tk
version0.1.0
sourcesrc
created_at2023-08-26 19:25:38.565735
updated_at2023-08-26 19:25:38.565735
descriptionSimple tool to split data.
homepagehttps://github.com/vgobbo/split-tk
repositoryhttps://github.com/vgobbo/split-tk
max_upload_size
id955673
size13,851
Vinicius Gobbo Antunes de Oliveira (vgobbo)

documentation

https://github.com/vgobbo/split-tk

README

split-tk

Helpers for splitting stuff, like files.

Simply install with cargo install split-tk, and start using it.

For example, suppose you want to split a sequence of numbers in sets of ten:

$ seq 1 35 | split-tk --size 10 -- echo '{}'
1,2,3,4,5,6,7,8,9,10
11,12,13,14,15,16,17,18,19,20
21,22,23,24,25,26,27,28,29,30
31,32,33,34,35

Use {} (just like GNU parallel) to specify where the batch should be placed in the command. It can be specified as many times as you want.

If playing with json this can be inconvenient since {} is a valid json itself, you can specify a different replacement tag with -g, for example:

$ seq 1 35 | split-tk --size 10 -g '!!' -- echo '!!'
1,2,3,4,5,6,7,8,9,10
11,12,13,14,15,16,17,18,19,20
21,22,23,24,25,26,27,28,29,30
31,32,33,34,35

To-Do

The following are some changes and features being considered in future versions. Feel free to suggest others.

  • [FEAT] File as an input.
  • [FEAT] Parallel command execution.
  • [FEAT] Redirect to command stdin instead of command line.
Commit count: 11

cargo fmt