On 2024-03-24 23:47, Gary Johnson wrote:
grep is small enough in concept that it shouldn't
require the user to read anything outside of the man page.
Maybe grep's concept is simple, but the program itself is not that
simple. For example, the grep man page doesn't document all the ins and
On 2024-03-24, Paul Eggert wrote:
> On 2024-03-24 06:06, David G. Pickett wrote:
> > Perhaps the man page should warn users that such last lines are ignored.
>
> They aren't ignored. And the documentation already covers this issue,
> on its very first page:
>
>
On 2024-03-24 06:06, David G. Pickett wrote:
Perhaps the man page should warn users that such last lines are ignored.
They aren't ignored. And the documentation already covers this issue, on
its very first page:
https://www.gnu.org/software/grep/manual/html_node/Introduction.html
This
Perhaps the man page should warn users that such last lines are ignored. Is
there a mention under an option to include or disclude them?
On Saturday, March 23, 2024 at 05:08:08 PM EDT, Martin Schulte
wrote:
Hello David!
Am Fri, 22 Mar 2024 20:42:12 + (UTC) schrieb "David G.
Hello David!
Am Fri, 22 Mar 2024 20:42:12 + (UTC) schrieb "David G. Pickett" via Bug
reports for GNU grep :
> Most users consider a line at EOF lacking a trailing newline as still a line,
> but perhaps some do not?
Well, POSIX doesn't:
On 3/22/24 16:42, David G. Pickett via Bug reports for GNU grep wrote:
>
> Most users consider a line at EOF lacking a trailing newline as
> still a line, but perhaps some do not?
>
Good ol "wc" says it is not a line. I would go with what "wc" claims.
--
Dennis Clarke
On 3/22/24 17:12, Paul Eggert wrote:
On 3/22/24 12:25, Dennis Clarke via Bug reports for GNU grep wrote:
Old Solaris 8, once fully patched, was definately
compliant with SUSv2 which is all of POSIX.1b-1993, POSIX.1c-1996
POSIX does not specify the behavior of grep when the input is not a text
On 3/22/24 12:25, Dennis Clarke via Bug reports for GNU grep wrote:
Old Solaris 8, once fully patched, was definately
compliant with SUSv2 which is all of POSIX.1b-1993, POSIX.1c-1996
POSIX does not specify the behavior of grep when the input is not a text
file, and a file that ends in a
$ (echo -n foo;sleep 10;echo bar)|time sh -c '(grep -q foo;echo $?)'00.00user
0.00system 0:10.00elapsed 0%CPU (0avgtext+0avgdata
2432maxresident)k0inputs+0outputs (0major+202minor)pagefaults 0swaps$ (echo -n
foo;sleep 10)|time sh -c '(grep -q foo;echo $?)'00.00user 0.00system
0:10.00elapsed
$ (echo foo;sleep 10;echo bar)|time grep -q foo;echo $?0.00user 0.00system
0:00.00elapsed 50%CPU (0avgtext+0avgdata 2432maxresident)k0inputs+0outputs
(0major+107minor)pagefaults 0swaps0$
The shell hangs for 10 seconds on its child pids but grep does not!
On Thursday, March 21, 2024 at
Maybe the opposite: -only_lines_with_newline ? Most users consider a line at
EOF lacking a trailing newline as still a line, but perhaps some do not?
On Friday, March 22, 2024 at 04:25:38 AM EDT, Niels Möller
wrote:
Paul Eggert writes:
> On 3/21/24 06:57, Niels Möller wrote:
>> I'm
On 3/21/24 22:58, jack...@fastmail.com wrote:
> Paul Eggert wrote:
>> although doable it would be a bit of a pain to program
>
> yup - sure would be a pain.
>
> If you're not sure whether your actual input of interest will end
> in a newline, can you add one, to "feed grep's newline hunger",
>
Neils noted:
>> (BTW, man page says about the -q option "Exit immediately with zero
>> status if any match is found", ...
If I had the master copy of that man page in front of me right now,
I'd change that to say "... if any matching line is found ..."
>> For the time being, I hacked together a
Paul Eggert writes:
> On 3/21/24 06:57, Niels Möller wrote:
>> I'm having grep -q read input from a pipe. I would like grep to exit
>> successfully as soon as a match occurs, without requiring the line to be
>> terminated by newline or EOF (unless the grep pattern includes '$', that
>> is).
>
>
Paul Eggert wrote:
> although doable it would be a bit of a pain to program
yup - sure would be a pain.
If you're not sure whether your actual input of interest will end
in a newline, can you add one, to "feed grep's newline hunger",
thus for instance replacing your example:
grep -q foo <(sh
On 3/21/24 06:57, Niels Möller wrote:
I'm having grep -q read input from a pipe. I would like grep to exit
successfully as soon as a match occurs, without requiring the line to be
terminated by newline or EOF (unless the grep pattern includes '$', that
is).
Grep used to behave almost that way.
Niels Möller writes:
> E.g., if I run
>
> (printf foo ; sleep 30) | grep -q foo
>
> I want grep to exit successfully right away. Currently, grep waits until
> it gets EOF on the input, 30 seconds later.
Sorry if I'm confused about how to script this. The following (bash
syntax) is a better
Hi,
I'm having grep -q read input from a pipe. I would like grep to exit
successfully as soon as a match occurs, without requiring the line to be
terminated by newline or EOF (unless the grep pattern includes '$', that
is).
E.g., if I run
(printf foo ; sleep 30) | grep -q foo
I want grep to
18 matches
Mail list logo