From 4b9caaea845c29381df6db051f98548c73b9e85c Mon Sep 17 00:00:00 2001 From: Emily Grace Seville Date: Mon, 27 Jun 2022 04:37:05 +1000 Subject: [PATCH] cut: refresh and add page (#7930) --- pages/common/cut.md | 24 ++++++------------------ pages/osx/cut.md | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 pages/osx/cut.md diff --git a/pages/common/cut.md b/pages/common/cut.md index d26cd3537..7630c47e5 100644 --- a/pages/common/cut.md +++ b/pages/common/cut.md @@ -3,26 +3,14 @@ > Cut out fields from stdin or files. > More information: . -- 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 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-}}` +`cut --{{characters}}={{1}} {{path/to/file}}` diff --git a/pages/osx/cut.md b/pages/osx/cut.md new file mode 100644 index 000000000..e78f290e7 --- /dev/null +++ b/pages/osx/cut.md @@ -0,0 +1,16 @@ +# cut + +> Cut out fields from stdin or files. +> More information: . + +- 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}}`