bin/163062: csplit includes extra lines in inner context
Scott Robinson
scott at quadhome.com
Sun Dec 4 15:50:10 UTC 2011
>Number: 163062
>Category: bin
>Synopsis: csplit includes extra lines in inner context
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Dec 04 15:50:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator: Scott Robinson
>Release: 8.1
>Organization:
>Environment:
FreeBSD hostname 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010 root at almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>Description:
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
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list