It works with first grep, but not with second one. I found --line-buffered parameter, but didn't helped. Can somebody help me?
Please use CODE tags when displaying sample input, sample output, and code segments.
Please always include the operating system and shell you're using whenever you start a thread in this forum. Some utilities are not available on all operating systems. Some options on common utilities vary from operating system to operating system. Some shell options (such as arrays) vary from shell to shell. If we don't know what operating system and shell you're using, it is sometimes hard to guess at what the real problem is that you're describing, and hard to create suggestions that will work in your environment.
The command utility takes a "simple" command (a utility and its arguments) as parameters. If does not take a "pipeline", a "compound" command, a "list", an if, a for, or an until loop, or a case statement.
If you want your shell to execute a pipeline (or one of the other non-simple commands listed above) and return the exit status of that pipeline, you need something more like:
shell -c "pipeline"
where shell is the name of the shell you're using and pipeline is the pipeline you want your shell to run.