Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rationalize grep behavior #31

Open
dspinellis opened this issue Dec 16, 2016 · 5 comments
Open

Rationalize grep behavior #31

dspinellis opened this issue Dec 16, 2016 · 5 comments
Assignees

Comments

@dspinellis
Copy link
Owner

dspinellis commented Dec 16, 2016

  • By default list only matching elements.
  • If exactly one -L -l or -v -o -c etc is specified, output only what is specified.
  • If --matching-lines is specified in addition to an option in the above list, also output the corresponding matching lines.
  • If more than one of the -L -l or -v -o -c etc options is specified generate one output per option.
  • If more than one -e option is specified, output one stream per option (do not implement this if internally the REs are merged into one).
@dspinellis
Copy link
Owner Author

Also grep behaves strangely when at the end of a pipeline.

$ dgsh -c 'cat /etc/motd | grep WARRANTY'

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent

dspinellis added a commit that referenced this issue Dec 16, 2016
The -w grep option is a workaround that should be removed when #31 is fixed.
@mfragkoulis
Copy link
Collaborator

mfragkoulis commented Jan 3, 2017

Commit 8a3c648 points to updated grep submodule HEAD.
The output streams work fine when they are used independently.
The implemented examples within /examples work fine.

TODO: Combining file streams (-l, -L) with inverted matches stucks in an fwrite() call.

@dspinellis
Copy link
Owner Author

Buffering may be needed here. We should not implement buffering at each command. Passing the grep output through a no-op dgsh-tee should solve this.

mfragkoulis added a commit that referenced this issue May 18, 2017
because it depends heavily on the grep utility,
which is under improvement (see issue #31).
Fix issue #62
mfragkoulis added a commit that referenced this issue Sep 27, 2017
Add tests for the combination of output channels that work
Fix issue #31
Fix issue #95
@mfragkoulis
Copy link
Collaborator

The wiki is updated.

@mfragkoulis
Copy link
Collaborator

mfragkoulis commented May 1, 2019

grep -c '@[ ]*define[ ][ ]*[a-zA-Z_][a-zA-Z0-9_]*(' produces a false match in test-dgsh.sh.

The pattern tries to identify macro definitions.

The baseline is given by the equivalent sgsh example (sgsh is dgsh's predecessor).

The test succeeds on MacOS, but fails on Linux.

@mfragkoulis mfragkoulis reopened this May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants