HomeUnixUNIX GREP Command in Depth

    UNIX GREP Command in Depth

    Date:

    GREP Command
    GREP stands for Globally search a regular expression and print

    1.Search a string and print from a log/text file

    Ex- grep “this” abc.text

    Above command will search for “this” string in abc.text and it will print the corresponding line to the console.

    2. Case insensitive search

    grep -I “this” abc.tx
    Above command will search for “this/THIS” string in abc.text and it will print the corresponding line to
    the console.

    3. Regular expression:
    Grep “line.*empty” abc.*

    Above command will search for “line. Some text which ends with empty” string in all the file named as abc and
    it will print the corresponding line to the console.

    Will search for strings like: line.abcempty, line.notempty etc.

    4.Full word search :

    Grep -w “sum” abc.text
    Above command will search for complete word “sum” in abc.text and it will print the corresponding line to the
    console.

    5. Full word search with regular expression:
    Grep -w “sum” *.log
    Above command will search for complete word “sum” in all the log files and it will print the corresponding line
    to the console.

    Book a 1-on-1
    Call Session

    Want Patrick's full attention? Nothing compares with a live one on one strategy call! You can express all your concerns and get the best and most straight forward learning experience.

    Related articles:

    GREP OR: Match Any Of Multiple Patterns

    GREP OR: Match Any Of Multiple Patterns-Find all the...

    Latest courses:

    Strategic Vision: Mastering Long-Term Planning for Business Success

    Introduction: Professional growth is a continuous journey of acquiring new...

    Leadership Excellence: Unlocking Your Leadership Potential for Business Mastery

    Introduction: Professional growth is a continuous journey of acquiring new...

    Marketing Mastery: Strategies for Effective Customer Engagement

    Introduction: Professional growth is a continuous journey of acquiring new...

    Financial Management: Mastering Numbers for Profitability and Sustainable Growth

    Introduction: Professional growth is a continuous journey of acquiring new...

    Innovation and Adaptability: Thriving in a Rapidly Changing Business Landscape

    Introduction: Professional growth is a continuous journey of acquiring new...