1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

doc update

This commit is contained in:
Kelly Brazil
2023-01-26 16:24:32 -08:00
parent 8e86a04448
commit 61b8e9f7b5
2 changed files with 12 additions and 8 deletions

View File

@ -329,15 +329,17 @@ could express the slice in a couple ways:
```bash ```bash
$ cat table.txt $ cat table.txt
We want to skip this header information We want to skip this header information
col1 col2 col1 col2
foo 1 foo 1
bar 1 bar 1
We also want to skip this footer We also want to skip this footer
$ cat table.txt | jc 1:-1 --asciitable $ cat table.txt | jc 1:-1 --asciitable
[{"col1":"foo","col2":"1"},{"col1":"bar","col2":"1"}] [{"col1":"foo","col2":"1"},{"col1":"bar","col2":"1"}]
$ cat table.txt | jc 1:4 --asciitable $ cat table.txt | jc 1:4 --asciitable
[{"col1":"foo","col2":"1"},{"col1":"bar","col2":"1"}] [{"col1":"foo","col2":"1"},{"col1":"bar","col2":"1"}]
``` ```
In this example `1:-1` and `1:4` line slices provide the same output.
Notice how when using positive integers the index location of `STOP` is Notice how when using positive integers the index location of `STOP` is
non-inclusive. Positive slices count from the first line of the output non-inclusive. Positive slices count from the first line of the output
toward the end starting at `0` as the first line. Negative slices count from toward the end starting at `0` as the first line. Negative slices count from
@ -354,7 +356,7 @@ Here is a quick breakdown:
| `:STOP` | lines from the beginning through `STOP - 1` | | `:STOP` | lines from the beginning through `STOP - 1` |
| `-START:STOP` | `START` lines from the end through `STOP - 1` | | `-START:STOP` | `START` lines from the end through `STOP - 1` |
| `START:-STOP` | lines `START` through `STOP` lines from the end | | `START:-STOP` | lines `START` through `STOP` lines from the end |
| `-START:` | `START` lines from the end through the rest or the output | | `-START:` | `START` lines from the end through the rest of the output |
| `:-STOP` | lines from the beginning through `STOP` lines from the end | | `:-STOP` | lines from the beginning through `STOP` lines from the end |
| `:` | all lines | | `:` | all lines |

View File

@ -191,15 +191,17 @@ could express the slice in a couple ways:
```bash ```bash
$ cat table.txt $ cat table.txt
We want to skip this header information We want to skip this header information
col1 col2 col1 col2
foo 1 foo 1
bar 1 bar 1
We also want to skip this footer We also want to skip this footer
$ cat table.txt | jc 1:-1 --asciitable $ cat table.txt | jc 1:-1 --asciitable
[{"col1":"foo","col2":"1"},{"col1":"bar","col2":"1"}] [{"col1":"foo","col2":"1"},{"col1":"bar","col2":"1"}]
$ cat table.txt | jc 1:4 --asciitable $ cat table.txt | jc 1:4 --asciitable
[{"col1":"foo","col2":"1"},{"col1":"bar","col2":"1"}] [{"col1":"foo","col2":"1"},{"col1":"bar","col2":"1"}]
``` ```
In this example `1:-1` and `1:4` line slices provide the same output.
Notice how when using positive integers the index location of `STOP` is Notice how when using positive integers the index location of `STOP` is
non-inclusive. Positive slices count from the first line of the output non-inclusive. Positive slices count from the first line of the output
toward the end starting at `0` as the first line. Negative slices count from toward the end starting at `0` as the first line. Negative slices count from
@ -216,7 +218,7 @@ Here is a quick breakdown:
| `:STOP` | lines from the beginning through `STOP - 1` | | `:STOP` | lines from the beginning through `STOP - 1` |
| `-START:STOP` | `START` lines from the end through `STOP - 1` | | `-START:STOP` | `START` lines from the end through `STOP - 1` |
| `START:-STOP` | lines `START` through `STOP` lines from the end | | `START:-STOP` | lines `START` through `STOP` lines from the end |
| `-START:` | `START` lines from the end through the rest or the output | | `-START:` | `START` lines from the end through the rest of the output |
| `:-STOP` | lines from the beginning through `STOP` lines from the end | | `:-STOP` | lines from the beginning through `STOP` lines from the end |
| `:` | all lines | | `:` | all lines |