1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2024-10-31 08:17:59 +01:00
tldr/pages/common/cut.md

28 lines
659 B
Markdown
Raw Normal View History

2014-03-07 18:43:18 +01:00
# cut
> Cut out fields from STDIN or files.
2014-03-07 18:43:18 +01:00
- Cut out the first sixteen characters of each line of STDIN:
2014-03-07 18:43:18 +01:00
`cut -c {{1-16}}`
2014-03-07 18:43:18 +01:00
- Cut out the first sixteen characters of each line of the given files:
2014-03-07 18:43:18 +01:00
`cut -c {{1-16}} {{file}}`
2014-03-07 18:43:18 +01:00
- Cut out everything from the 3rd character to the end of each line:
2014-03-07 18:43:18 +01:00
`cut -c{{3-}}`
2014-03-07 18:43:18 +01:00
- Cut out the fifth field of each line, using a colon as a field delimiter (default delimiter is tab):
2014-03-07 18:43:18 +01:00
`cut -d'{{:}}' -f{{5}}`
2014-03-07 18:43:18 +01:00
- Cut out the 2nd and 10th fields of each line, using a semicolon as a delimiter:
2014-03-07 18:43:18 +01:00
`cut -d'{{;}}' -f{{2,10}}`
- Cut out the fields 3 through 7 of each line, using a space as a delimiter:
`cut -d'{{ }}' -f{{3-7}}`