G Gabriel Turqos Active Member Apr 3, 2019 #1 I have a configuration file which is a simple text. I want to list some configuration line but except some sitring. How can I use Linux grep to exclude and search for given strings? Thanks in advance for your help!
I have a configuration file which is a simple text. I want to list some configuration line but except some sitring. How can I use Linux grep to exclude and search for given strings? Thanks in advance for your help!
livix07 Honorable Member Apr 3, 2019 #2 I think you have more chances to find the answer on Stackoverflow.
Neemobeer Cloud Security Engineer Staff member Apr 3, 2019 #3 Specifically using grep you'd need to pipe one grep to another such as say you want to find occurrences of 'car' but not 'racecar' grep 'car' /home/user/somefile.txt | grep -v 'racecar' It would be a shorter command if you used egrep but you'd need to understand regex expressions to make correctly.
Specifically using grep you'd need to pipe one grep to another such as say you want to find occurrences of 'car' but not 'racecar' grep 'car' /home/user/somefile.txt | grep -v 'racecar' It would be a shorter command if you used egrep but you'd need to understand regex expressions to make correctly.