2014-03-07 17:43:18 +00:00
|
|
|
# cut
|
|
|
|
|
2021-01-31 17:05:18 +00:00
|
|
|
> Cut out fields from stdin or files.
|
2021-03-30 12:39:27 +01:00
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/cut-invocation.html>.
|
2014-03-07 17:43:18 +00:00
|
|
|
|
2021-01-31 17:05:18 +00:00
|
|
|
- Cut out the first sixteen characters of each line of stdin:
|
2014-03-07 17:43:18 +00:00
|
|
|
|
2014-03-08 01:12:41 +00:00
|
|
|
`cut -c {{1-16}}`
|
2014-03-07 17:43:18 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Cut out the first sixteen characters of each line of the given files:
|
2014-03-07 17:43:18 +00:00
|
|
|
|
2014-03-08 01:12:41 +00:00
|
|
|
`cut -c {{1-16}} {{file}}`
|
2014-03-07 17:43:18 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Cut out everything from the 3rd character to the end of each line:
|
2014-03-07 17:43:18 +00:00
|
|
|
|
2018-11-12 11:41:20 +00:00
|
|
|
`cut -c {{3-}}`
|
2014-03-07 17:43:18 +00:00
|
|
|
|
2016-05-07 18:28:06 +01:00
|
|
|
- Cut out the fifth field of each line, using a colon as a field delimiter (default delimiter is tab):
|
2014-03-07 17:43:18 +00:00
|
|
|
|
2014-03-08 01:12:41 +00:00
|
|
|
`cut -d'{{:}}' -f{{5}}`
|
2014-03-07 17:43:18 +00:00
|
|
|
|
2016-05-07 18:28:06 +01:00
|
|
|
- Cut out the 2nd and 10th fields of each line, using a semicolon as a delimiter:
|
2014-03-07 17:43:18 +00:00
|
|
|
|
2016-05-07 18:28:06 +01:00
|
|
|
`cut -d'{{;}}' -f{{2,10}}`
|
2014-03-08 01:12:41 +00:00
|
|
|
|
2018-06-23 12:07:17 +01:00
|
|
|
- Cut out the fields 3 through to the end of each line, using a space as a delimiter:
|
2014-03-08 01:12:41 +00:00
|
|
|
|
2018-06-23 12:07:17 +01:00
|
|
|
`cut -d'{{ }}' -f{{3-}}`
|