Re: strict grep when patterns are presented on standard input

From: Dana French (dfrench_at_mtxia.com)
Date: 07/28/04


Date: 28 Jul 2004 12:05:08 -0700

ariel.burbaickij@gmail.com (Ariel Burbaickij) wrote in message news:<3058f9b4.0407280407.74335d3d@posting.google.com>...
> Hello dear newsgroup participants,
>
> I have following problem:
> I would like to greo for some let us say IP addresses
> in /etc/hosts file. Grep is used in the pipe of commands
> and it is not known ahead of time what IP addresses will
> be presented to grep, so grep is used with -f - option.
> In the file entries of both 192.168.111.11 and 192.168.111.112
> are presented,only 192.168.111.11 is presented to the grep on
> standard input but both are presented on the standard output
> because they both contain the same string. Now my question:
> Can strict option/quotes etc. be applied to the grep when it becomes
> its arguments from standard input in the pipe (i.e. as standard output from
> other command)? Clear, I can add just another sed command to the pipe
> that will prepend and append quote sign but I so far it would be interesting
> to understand whether it goes directly with grep or not
>
>
> With Best Regards
> Ariel Burbaickij

I may need to fire up Visio to diagram that question..... Let me see
if I am understanding correctly.

 You want to use the output from a grep (maybe sed too) as the regular
expression argument to another grep command??? Is that right???

--------------------------------------------------------
Dana French dfrench@mtxia.com
Mt Xia Technical Consulting Group http://www.mtxia.com
100% Spam Free Email http://www.ridmail.com
MicroEmacs http://uemacs.tripod.com
Korn Shell Web http://dfrench.tripod.com/kshweb.html



Relevant Pages

  • Re: Using cmd-line pipe with and without xargs
    ... 'prog | anotherprog' puts the standard output of prog into ... the standard input of anotherprog." ... The OS supplies the command line arguments in an analogous way. ... what I did was neglect to read stdin from my ...
    (comp.unix.shell)
  • Re: Connecting Fortran code to TCP/IP socket
    ... If you invoke your program with the netcat command the standard input ... Runs "command" with the standard output going to host.example.com:port ...
    (comp.lang.fortran)
  • Re: BASH issue with spaces in file names..
    ... But if you really need the 'ls' command, you can take a pipe: ... du doesn't use standard input. ... column when its standard output isn't a terminal. ...
    (comp.unix.shell)
  • RE: [opensuse] Add variables to standard output for
    ... I want to take the standard output from a grep ... command, but I also want to add my own values to the resulting line. ... The views expressed in this e-mail are the views of the individual sender and should in no way be construed as the views of the Company. ...
    (SuSE)
  • Re: BASH issue with spaces in file names..
    ... But if you really need the 'ls' command, ... du doesn't use standard input. ... column when its standard output isn't a terminal. ... above in a test-directory but 'ls' dosn't returned a error-message. ...
    (comp.unix.shell)