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

clarify slice usage

This commit is contained in:
Kelly Brazil
2023-01-27 08:01:32 -08:00
parent d6c665f74b
commit 21ee3c0e78
2 changed files with 14 additions and 14 deletions

View File

@ -316,7 +316,7 @@ option.
### Slice
Line slicing is supported using the `START:STOP` syntax similar to Python
slicing. This allows you to skip lines at the beginning and/or end of the
output you would like `jc` to convert.
`STDIN` input you would like `jc` to convert.
`START` and `STOP` can be positive or negative integers or blank and allow
you to specify how many lines to skip and how many lines to process.
@ -340,16 +340,16 @@ $ cat table.txt | jc 1:4 --asciitable
```
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
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
the last line toward the beginning starting at `-1` as the last line. This
is also the way [Python's slicing](https://stackoverflow.com/questions/509211/understanding-slicing)
When using positive integers the index location of `STOP` is non-inclusive.
Positive slices count from the first line of the input toward the end
starting at `0` as the first line. Negative slices count from the last line
toward the beginning starting at `-1` as the last line. This is also the way
[Python's slicing](https://stackoverflow.com/questions/509211/understanding-slicing)
feature works.
Here is a quick breakdown:
| Slice | Description |
| Slice Notation | Input lines processed |
|----------------|--------------------------------------------------------------|
| `START:STOP` | lines `START` through `STOP - 1` |
| `START:` | lines `START` through the rest of the output |

View File

@ -178,7 +178,7 @@ option.
### Slice
Line slicing is supported using the `START:STOP` syntax similar to Python
slicing. This allows you to skip lines at the beginning and/or end of the
output you would like `jc` to convert.
`STDIN` input you would like `jc` to convert.
`START` and `STOP` can be positive or negative integers or blank and allow
you to specify how many lines to skip and how many lines to process.
@ -202,16 +202,16 @@ $ cat table.txt | jc 1:4 --asciitable
```
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
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
the last line toward the beginning starting at `-1` as the last line. This
is also the way [Python's slicing](https://stackoverflow.com/questions/509211/understanding-slicing)
When using positive integers the index location of `STOP` is non-inclusive.
Positive slices count from the first line of the input toward the end
starting at `0` as the first line. Negative slices count from the last line
toward the beginning starting at `-1` as the last line. This is also the way
[Python's slicing](https://stackoverflow.com/questions/509211/understanding-slicing)
feature works.
Here is a quick breakdown:
| Slice | Description |
| Slice Notation | Input lines processed |
|----------------|--------------------------------------------------------------|
| `START:STOP` | lines `START` through `STOP - 1` |
| `START:` | lines `START` through the rest of the output |