AKSHIT AKSHIT - 12 days ago 5x
Linux Question

Grep on a file that is being written by another application

I am using grep to match a string in a file but at the same time another application might be writing to the same file.

In that case what will grep do.

Will it allow the file to being written by other application or will it not give access to the file?

Also if it does give access will my grep results be based on before the file was written or after?

Basically I want the grep to not lock the access to the file but if it does that is their an alternative to prevent it from doing so..

My Sample command:
egrep -r -i "regex" /directory/*


grep does not lock the file, so it is safe to use it, while the file is being actively used by another application