Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

csv-reshapeshape is a new utility for various operations on reshaping csv data.

For now, only one operation is implemented: concatenate:

Concatenate by Grouping Input Records

Code Block
> ( echo 1,a; echo 2,b; echo 3,c; echo 4,d; ) | csv-reshapeshape concatenate -n 2
1,a,2,b
3,c,4,d

Note: For ascii text inputs the records do not have to be regular or even have the same number of fields.

Concatenate by Sliding Window

ASCII:

Code Block
> ( echo 1,a; echo 2,b; echo 3,c; echo 4,d; ) | csv-reshapeshape concatenate -n 2 --sliding-window
1,a,2,b
2,b,3,c
3,c,4,d

...

Code Block
> ( echo 1,a; echo 2,b; echo 3,c; echo 4,d; ) | csv-to-bin ui,c | csv-reshapeshape concatenate -n 2 --sliding-window --binary ui,c | csv-from-bin ui,c,ui,c
1,a,2,b
2,b,3,c
3,c,4,d