Reshape delimited text files.
Reads input from a file if the filename is given as the last argument.
stdin stream (e.g. unix pipe) otherwise, until terminated by an EOF signal.
A filename argument of
- can also be used to switch to
Note that the whole input is read into memory at once for processing.
printf 'a,b,c'|reshape -d, -t a b c
printf '%s\n%s\n' 'a,b,c' '1,2,3'|reshape -d, -s3x2 a,b c,1 2,3
Output is right-aligned by default (use
--nopad to disable):
printf '%s\n%s\n%s\n' 'a,b,c' '1,2,3' 'foo,bar,baz'|reshape -d, a, b, c 1, 2, 3 foo,bar,baz
Skip individual rows/columns or ranges:
printf '%s\n%s\n%s\n' 'a,b,c' '1,2,3' 'foo,bar,baz'|reshape -d, -r:1 -c:1-2 3 baz
Note that unicode symbols are currently not aligned properly:
printf '%s\n%s\n%s\n' ',a,b,c,d' ',1,2,3,4' ',",",,ß'|reshape -d, -c1 -s3x4 a,b, c,d 1,2, 3,4 ",", ,ß,
After building the
reshape binary, put it in one of your
nim c -d:release src/reshape.nim
nim c src/reshape.nim
nimble test in the source code root directory.
Run with the
--help option if built, or check the
printHelp proc in the code.
Note that short options must not be separated from their arguments by a space.
= instead, or append the argument to the option flag directly.
This behaviour is inherited from Nim's parseopt module.