Dev
find log where string does not exist, with grep -iv
nauco
2023. 4. 25. 17:25
728x90
반응형
How can I find specific lines where string does not exist without case with grep commands.
grep -iv
Search a string without case sensitivity | grep -i "string" |
Select a line where no matching pattern exists | grep -v "string" |
Select lines where "string" does not exist, regardless of case | grep -iv "string" |
For example, How can I find which shard's state is not started in ElasticSearch with catAPI
curl -X GET "localhost:9200/_cat/shards?h=idx,sh,pr,st,docs,unassigned.reason" | grep -iv started
->
index shard prirep state docs unassigned.reason
access_log_1 1 p UNASSIGNED .. NODE_LEFT
access_log_2 2 p UNASSIGNED .. NODE_LEFT