in reply to Re^2: Get specific entries from a file which is always growing
in thread Get specific entries from a file which is always growing
I suppose you're talking about the second command. The first grep command should definitely put something in File2, as long as there's some occurrences of "IDENTIFIER" in File1 at the time you run the command.
The "problem" with the second command line is that when redirecting grep's output to a file, the stream will be fully buffered. This means that nothing will be written to File2 before the buffer (typically 4K in size) is full, or tail closes its pipe to grep (the latter won't happen when tail is running in "follow" (-f) mode). Depending on how much output grep produces with your data, filling the buffer may take a while...
Whether the buffering is a problem depends on your expectations. If you want File2 to be updated immediately with every newly found occurrence, then the above shell command is not the right tool for the purpose. In this case, you could write the tail/grep combo yourself in Perl (as already suggested), in which case you do have control over buffering (i.e. you can flush data immediately).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Get specific entries from a file which is always growing
by NetWallah (Canon) on Jun 11, 2011 at 05:23 UTC |