[BusyBox] bug#1064: grep ^$ problem
Kent Robotti
robotti at metconnect.com
Fri Oct 13 02:23:38 UTC 2000
Shouldn't '^$' only match any blank lines?
That's what the gnu grep seems to do.
This it with the latest cvs bb grep.
$ cat twoline.txt
This file has
two lines
blank line 3
carriage return blank line
The bb grep returns this.
$ cat twoline.txt | ./busybox grep '^$'
This file has
two lines
blank line 3
$
The gnu grep returns this.
$ cat twoline.txt | grep '^$'
blank line 3
$
The bb grep returns this.
$ cat twoline.txt | ./busybox grep -v '^$'
$
The gnu grep returns this.
$ cat twoline.txt | grep -v '^$'
This file has
two lines
$
On Thu, Oct 12, 2000 at 01:44:02PM -0500, David Douthitt wrote:
> I'm using
>
> grep -v "^$"
>
> with one to four line files, and in one particular case it failed
> repeatedly (on a one line file).
David,
I cannot duplicate this bug with the latest from CVS. Some tests follow:
---cut here------
[markw at shiva busybox]$ cat oneline.txt
This file has one line
[markw at shiva busybox]$ cat oneline.txt | ./busybox grep '^$'
This file has one line
[markw at shiva busybox]$ cat twolines.txt
This file has
two lines
[markw at shiva busybox]$ cat twolines.txt | ./busybox grep '^$'
This file has
two lines
[markw at shiva busybox]$ cat threelines.txt
This file has
only
three lines
[markw at shiva busybox]$ cat threelines.txt | ./busybox grep '^$'
This file has
only
three lines
[markw at shiva busybox]$ cat fourlines.txt
This file
has
only
four lines
[markw at shiva busybox]$ cat fourlines.txt | ./busybox grep '^$'
This file
has
only
four lines
[markw at shiva busybox]$
---cut here------
I checked to see if it was a problem with the way the shell escapes quotes so
I tried the following:
---cut here------
[markw at shiva busybox]$ cat oneline.txt | ./busybox grep ^$
This file has one line
[markw at shiva busybox]$ cat oneline.txt | ./busybox grep '^$'
This file has one line
[markw at shiva busybox]$ cat oneline.txt | ./busybox grep "^$"
This file has one line
---cut here------
They all worked.
Last, I tried doing the same tests inside busybox shell and got the following:
---cut here------
/home/markw/devel/busybox # cat oneline.txt | grep ^$
This file has one line
cat: oneline.txt: No such file or directory
/home/markw/devel/busybox # cat oneline.txt | grep '^$'
This file has one line
cat: oneline.txt: No such file or directory
/home/markw/devel/busybox # cat oneline.txt | grep "^$"
This file has one line
cat: oneline.txt: No such file or directory
---cut here------
It did consistently produce an error, but one different from the one you
found, and unrelated, I think.
So I'm sorry, but I can't dup the problem. Can you check out the latest from
CVS and see if you can dup it. If so, please send the file that you are
catting / grepping that produces the error.
Thanks,
Mark Whitley
markw at lineo.com
More information about the busybox
mailing list