Date: Sun, 4 Dec 2011 15:42:49 GMT From: Scott Robinson <scott@quadhome.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/163062: csplit includes extra lines in inner context Message-ID: <201112041542.pB4FgnRV051610@red.freebsd.org> Resent-Message-ID: <201112041550.pB4FoAaq075787@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112041542.pB4FgnRV051610>