Skip to content

Commit 10c078a

Browse files
committed
doc iotas
1 parent 5cfa25d commit 10c078a

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

examples/make-multi-select.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ EOT
99

1010
while IFS=# read command description; do
1111
cat <<EOT
12-
## $description
12+
### $description
1313
\`\`\`
1414
> $command
1515
@@ -32,5 +32,6 @@ echo -e "a\\tb\\tc\\n3\\t4\\t5" | pick -A '.*'/x::__,sq#Create a new column name
3232
echo -e "a\\tb\\tc\\n3\\t4\\t5" | pick '.*'//x::__,sq#Using the double slash has the same effect, but columns are grouped pairwise
3333
echo -e "a\\tb\\tc\\n3\\t4\\t5" | pick '.*'//_pct::__:c^1,pct#This can be useful when expressing as a percentage, here relative to column c
3434
echo -e "a\\tb\\tc\\n3\\t4\\t5" | pick -A '.*'/x::__,sq '.*'/y::__,sq,sq#Multiple computations are possible
35-
echo -e "a\\tb\\tc\\n3\\t4\\t5" | pick -i '.*'::'.*',addall#A (not particularly useful) curiosity - the first column is 3+4+5=12, then the second column is 12+4+5=21, the third 12+21+5
35+
echo -e "a\\tb\\tc\\n3\\t4\\t5" | pick -i '.*'::'.*',addall#A (not very useful) curiosity - the first column is a = (a=3)+(b=4)+(c=5)=12, then the second is b = (a=12)+(b=4)+(c=5)=21, the third is c = (a=12)+(b=21)+(c=5)
36+
echo -e "a\\tb\\tc\\n3\\t4\\t5" | pick -Ai '.*'/x::'.*',addall#(continued) this behaviour disappears if the values are stored in a new name
3637
EOI

examples/multi-select.md

+21-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Examples of selecting and changing multiple columns simultaneously
22

3-
## Select all columns for output (normally achieved with -A)
3+
### Select all columns for output (normally achieved with -A)
44
```
55
> echo -e "a\tb\tc\n3\t4\t5" | pick '.*'
66
@@ -9,23 +9,23 @@ a b c
99
```
1010

1111

12-
## Select all columns, apply the same computation (cannot be empty however)
12+
### Select all columns, apply the same computation (cannot be empty however)
1313
```
1414
> echo -e "a\tb\tc\n3\t4\t5" | pick '.*'::
1515
1616
Compute cannot be empty
1717
```
1818

1919

20-
## The -i in-place options is required to allow potential overwriting of existing columns
20+
### The -i in-place options is required to allow potential overwriting of existing columns
2121
```
2222
> echo -e "a\tb\tc\n3\t4\t5" | pick '.*'::^foo
2323
2424
Name a already defined (use -i for in-place change)
2525
```
2626

2727

28-
## Computation consisting of the constant value 'foo'
28+
### Computation consisting of the constant value 'foo'
2929
```
3030
> echo -e "a\tb\tc\n3\t4\t5" | pick -i '.*'::^foo
3131
@@ -34,7 +34,7 @@ foo foo foo
3434
```
3535

3636

37-
## Computation consisting of the column itself
37+
### Computation consisting of the column itself
3838
```
3939
> echo -e "a\tb\tc\n3\t4\t5" | pick -i '.*'::__
4040
@@ -43,7 +43,7 @@ a b c
4343
```
4444

4545

46-
## Computation consisting of the column duplicated
46+
### Computation consisting of the column duplicated
4747
```
4848
> echo -e "a\tb\tc\n3\t4\t5" | pick -i '.*'::__:__
4949
@@ -52,7 +52,7 @@ a b c
5252
```
5353

5454

55-
## Computation consisting of the column squared
55+
### Computation consisting of the column squared
5656
```
5757
> echo -e "a\tb\tc\n3\t4\t5" | pick -i '.*'::__,sq
5858
@@ -61,7 +61,7 @@ a b c
6161
```
6262

6363

64-
## Create a new column name by adding 'x'; now -i is not needed, -A shows the original columns
64+
### Create a new column name by adding 'x'; now -i is not needed, -A shows the original columns
6565
```
6666
> echo -e "a\tb\tc\n3\t4\t5" | pick -A '.*'/x::__,sq
6767
@@ -70,7 +70,7 @@ a b c ax bx cx
7070
```
7171

7272

73-
## Using the double slash has the same effect, but columns are grouped pairwise
73+
### Using the double slash has the same effect, but columns are grouped pairwise
7474
```
7575
> echo -e "a\tb\tc\n3\t4\t5" | pick '.*'//x::__,sq
7676
@@ -79,7 +79,7 @@ a ax b bx c cx
7979
```
8080

8181

82-
## This can be useful when expressing as a percentage, here relative to column c
82+
### This can be useful when expressing as a percentage, here relative to column c
8383
```
8484
> echo -e "a\tb\tc\n3\t4\t5" | pick '.*'//_pct::__:c^1,pct
8585
@@ -88,7 +88,7 @@ a a_pct b b_pct c c_pct
8888
```
8989

9090

91-
## Multiple computations are possible
91+
### Multiple computations are possible
9292
```
9393
> echo -e "a\tb\tc\n3\t4\t5" | pick -A '.*'/x::__,sq '.*'/y::__,sq,sq
9494
@@ -97,7 +97,7 @@ a b c ax bx cx ay by cy
9797
```
9898

9999

100-
## A (not particularly useful) curiosity - the first column is 3+4+5=12, then the second column is 12+4+5=21, the third 12+21+5
100+
### A (not very useful) curiosity - the first column is a = (a=3)+(b=4)+(c=5)=12, then the second is b = (a=12)+(b=4)+(c=5)=21, the third is c = (a=12)+(b=21)+(c=5)
101101
```
102102
> echo -e "a\tb\tc\n3\t4\t5" | pick -i '.*'::'.*',addall
103103
@@ -106,3 +106,12 @@ a b c
106106
```
107107

108108

109+
### (continued) this behaviour disappears if the values are stored in a new name
110+
```
111+
> echo -e "a\tb\tc\n3\t4\t5" | pick -Ai '.*'/x::'.*',addall
112+
113+
a b c ax bx cx
114+
3 4 5 12 12 12
115+
```
116+
117+

0 commit comments

Comments
 (0)