Skip to content

Commit ba8f804

Browse files
authored
csplit: clarify how the regex option works (#19157)
1 parent 05b5094 commit ba8f804

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pages/linux/csplit.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,26 @@
44
> This generates files named "xx00", "xx01", and so on.
55
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/csplit-invocation.html>.
66
7-
- Split a file at lines 5 and 23:
7+
- Split a file in two parts, starting the second one at line 10:
88

9-
`csplit {{path/to/file}} 5 23`
9+
`csplit {{path/to/file}} 10`
1010

11-
- Split a file every 5 lines (this will fail if the total number of lines is not divisible by 5):
11+
- Split a file in three parts, starting the latter parts in lines 7 and 23:
12+
13+
`csplit {{path/to/file}} 7 23`
14+
15+
- Start a new part at every 5th line (will fail if number of lines is not divisible by 5):
1216

1317
`csplit {{path/to/file}} 5 {*}`
1418

15-
- Split a file every 5 lines, ignoring exact-division error:
19+
- Start a new part at every 5th line, ignoring exact-division error:
1620

1721
`csplit {{[-k|--keep-files]}} {{path/to/file}} 5 {*}`
1822

19-
- Split a file at line 5 and use a custom prefix for the output files:
23+
- Split a file above line 5 and use a custom prefix for the output files (default is `xx`):
2024

2125
`csplit {{path/to/file}} 5 {{[-f|--prefix]}} {{prefix}}`
2226

23-
- Split a file at a line matching a `regex`:
27+
- Split a file above the first line matching a `regex` pattern:
2428

2529
`csplit {{path/to/file}} /{{regex}}/`

0 commit comments

Comments
 (0)