mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-07-23 22:15:28 +02:00
tuc: add page (#15033)
Co-authored-by: Wiktor Perskawiec <git@spageektti.cc>
This commit is contained in:
parent
e35ccbf20c
commit
dbfc758e1d
1 changed files with 25 additions and 0 deletions
25
pages/common/tuc.md
Normal file
25
pages/common/tuc.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
# tuc
|
||||
|
||||
> Cut text (or bytes) where a delimiter matches, then keep the desired parts.
|
||||
> A more user-friendly and powerful version of `cut` with sensible defaults.
|
||||
> More information: <https://github.com/riquito/tuc>.
|
||||
|
||||
- Cut and rearrange fields:
|
||||
|
||||
`echo "foo bar baz" | tuc -d '{{ }}' -f {{3,2,1}}`
|
||||
|
||||
- Replace the delimiter `space` with an arrow:
|
||||
|
||||
`echo "foo bar baz" | tuc -d ' ' -r ' ➡ '`
|
||||
|
||||
- Keep a range of fields:
|
||||
|
||||
`echo "foo bar baz" | tuc -d ' ' -f {{2:}}`
|
||||
|
||||
- Cut using regular expressions:
|
||||
|
||||
`echo "a,b, c" | tuc -e '{{[, ]+}}' -f {{1,3}}`
|
||||
|
||||
- Emit JSON output:
|
||||
|
||||
`echo "foo bar baz" | tuc -d '{{ }}' --json`
|
Loading…
Add table
Reference in a new issue