mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 09:22:07 +02:00
cut: refresh and add page (#7930)
This commit is contained in:
parent
337c1c06d0
commit
4b9caaea84
2 changed files with 22 additions and 18 deletions
|
@ -3,26 +3,14 @@
|
||||||
> Cut out fields from stdin or files.
|
> Cut out fields from stdin or files.
|
||||||
> More information: <https://www.gnu.org/software/coreutils/cut>.
|
> More information: <https://www.gnu.org/software/coreutils/cut>.
|
||||||
|
|
||||||
- Cut out the first sixteen characters of each line of stdin:
|
- Print a specific character/field range of each line:
|
||||||
|
|
||||||
`cut -c {{1-16}}`
|
`{{command}} | cut --{{characters|fields}}={{1|1,10|1-10|1-|-10}}`
|
||||||
|
|
||||||
- Cut out the first sixteen characters of each line of the given files:
|
- Print a range of each line with a specific delimiter:
|
||||||
|
|
||||||
`cut -c {{1-16}} {{file}}`
|
`{{command}} | cut --delimiter="{{,}}" --{{characters}}={{1}}`
|
||||||
|
|
||||||
- Cut out everything from the 3rd character to the end of each line:
|
- Print a range of each line of the specific file:
|
||||||
|
|
||||||
`cut -c {{3-}}`
|
`cut --{{characters}}={{1}} {{path/to/file}}`
|
||||||
|
|
||||||
- Cut out the fifth field of each line, using a colon as a field delimiter (default delimiter is tab):
|
|
||||||
|
|
||||||
`cut -d'{{:}}' -f{{5}}`
|
|
||||||
|
|
||||||
- Cut out the 2nd and 10th fields of each line, using a semicolon as a delimiter:
|
|
||||||
|
|
||||||
`cut -d'{{;}}' -f{{2,10}}`
|
|
||||||
|
|
||||||
- Cut out the fields 3 through to the end of each line, using a space as a delimiter:
|
|
||||||
|
|
||||||
`cut -d'{{ }}' -f{{3-}}`
|
|
||||||
|
|
16
pages/osx/cut.md
Normal file
16
pages/osx/cut.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# cut
|
||||||
|
|
||||||
|
> Cut out fields from stdin or files.
|
||||||
|
> More information: <https://manned.org/man/freebsd-13.0/cut.1>.
|
||||||
|
|
||||||
|
- Print a specific character/field range of each line:
|
||||||
|
|
||||||
|
`{{command}} | cut -{{c|f}} {{1|1,10|1-10|1-|-10}}`
|
||||||
|
|
||||||
|
- Print a range of each line with a specific delimiter:
|
||||||
|
|
||||||
|
`{{command}} | cut -d "{{,}}" -{{c}} {{1}}`
|
||||||
|
|
||||||
|
- Print a range of each line of a specific file:
|
||||||
|
|
||||||
|
`cut -{{c}} {{1}} {{path/to/file}}`
|
Loading…
Add table
Reference in a new issue