1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Exclude unwanted string from Linux grep

Discussion in 'Operating System' started by Gabriel9999, Apr 3, 2019.

Tags:
  1. Gabriel9999

    Gabriel9999 New Member

    Joined:
    Mar 12, 2019
    Messages:
    17
    Likes Received:
    1
    Trophy Points:
    3
    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!
     
  2. samueltarcin9999

    samueltarcin9999 New Member

    Joined:
    Mar 12, 2019
    Messages:
    15
    Likes Received:
    10
    Trophy Points:
    3
    There are different ways to exclude and grep given a text file or input stream. I generally prefer the most basic one where use two grep where the first one is for exclude with -v option and pipe to second one where I grep for my string. grep -v 'able' config.txt | grep 'system' For more information look= poftut.com/introduction-to-linux-grep-command-with-examples/
     
    Gabriel9999 likes this.

Share This Page