Skip to content

Commit 926632f

Browse files
added details for csplit bug
1 parent e397135 commit 926632f

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

csplit.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,33 @@
250250

251251
==> xx02 <==
252252
tea
253+
</code></pre><blockquote><p><img src=./images/warning.svg alt=warning> Suppressing matched lines for regexp based split other than <code>{*}</code> usage doesn't give expected results. See <a href=https://lists.gnu.org/archive/html/bug-coreutils/2020-08/msg00006.html>this bug report</a> for more details.</blockquote><pre><code class=language-bash>$ seq 11 14 | csplit -q --suppress-matched - '/3/'
254+
# the matching line wasn't suppressed
255+
$ head xx*
256+
==> xx00 <==
257+
11
258+
12
259+
260+
==> xx01 <==
261+
13
262+
14
263+
264+
$ rm xx*
265+
266+
$ seq 11 16 | csplit -q --suppress-matched - '/[35]/' '{1}'
267+
# the first matching line was correctly suppressed
268+
# but the second matching line wasn't suppressed
269+
$ head xx*
270+
==> xx00 <==
271+
11
272+
12
273+
274+
==> xx01 <==
275+
14
276+
277+
==> xx02 <==
278+
15
279+
16
253280
</code></pre><h2 id=exclude-empty-files><a class=header href=#exclude-empty-files>Exclude empty files</a></h2><p>There are various cases that can result in empty output files. For example, first or last line matching the given split condition. Another possibility is <code>--suppress-matched</code> option combined with consecutive lines matching during multiple splits. Here's an example:<pre><code class=language-bash>$ csplit -q --suppress-matched purchases.txt '/coffee\|tea/' '{*}'
254281

255282
$ head xx*

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

searchindex.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)