Skip to content

Commit

Permalink
split: allow /0/ pattern split (#807)
Browse files Browse the repository at this point in the history
* When splitting input file with -p PATTERN, allow pattern to be '0'
* Probably this is a bad pattern to use, but ignoring -p0 is not correct

%printf "aa\n0\nbb\n0\ncc\n" | perl split -p0
%for f in xaa*; do echo "$f:"; cat $f; done
xaaa:
aa
xaab:
0
bb
xaac:
0
cc
  • Loading branch information
mknos authored Nov 13, 2024
1 parent 8e8af73 commit 8934637
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/split
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ if ($opt{'b'}) {
}

## Split on patterns.
elsif ($opt{'p'}) {
elsif (defined $opt{'p'}) {
my $regex = $opt{p};
my $fh = nextfile ($prefix);

Expand Down

0 comments on commit 8934637

Please sign in to comment.