Bug 163062 - csplit(1) includes extra lines in inner context
Summary: csplit(1) includes extra lines in inner context
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-04 15:50 UTC by Scott Robinson
Modified: 2018-01-03 05:14 UTC (History)
0 users

See Also:


Attachments
patch.txt (264 bytes, text/plain; charset=US-ASCII)
2013-06-30 16:47 UTC, gaborg1988
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Robinson 2011-12-04 15:50:10 UTC
csplit includes the lines of matching context lines for inner matches
when using repeated matches.

I don't know if this is correct or not. The GNU version of csplit doesn't
do it.

My discovery and investigation is documented:
http://stackoverflow.com/questions/8373793/how-can-i-split-a-file-up-by-matching-lines-context/8374825

How-To-Repeat: #!/bin/sh

test -e

work="$(basename $0).$RANDOM"
mkdir $work

csplit -sk -f "$work/" - '/#/' '{9999}' <<EOF
First
#
Second
#
Third
EOF

if [ $(grep -c '#' $work/01) -eq 2 ]; then
  echo FAIL Repeat
else
  echo PASS Repeat
fi

rm $work/*

csplit -sk -f "$work/" - '/#/' '/#/' <<EOF
First
#
Second
#
Third
EOF

if [ $(grep -c '#' $work/01) -eq 2 ]; then
  echo FAIL Exact
else
  echo PASS Exact
fi

uname -a
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:18 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped