• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Do not show line haveing particular keyword by grep command

October 9, 2013 by Sharad Chhetri 2 Comments

Do not show line haveing particular keyword by grep command

Generally we use grep command to get the lines which has particular line in a file.There is one more option in grep by which you will not get the lines in output which has some specific keyword or keywords.

To do not get lines in output with specific keywords by using grep command,use the given below syntax

In given below replace the keyword with your desired word which you do not want to show in output

(1) For single keyword in a file

grep -v keyword filename

(2) For multiple keyword in a file


grep -v 'keyword1|keyword2|keyword3|keywordN' filename

(3) For recursively search all files inside folders and its subfolders use-r option in grep command.

for single keyword

grep -r -v 'keyword' filename /absoulte-path-of-directory/*

for multiple keyword

grep -r -v 'keyword1|keyword2|keyword3|keywordN' absoulte-path-of-directory/*

Note: For insensitive case use -i option with all above examples.
eg.

grep -i -v wordpress filename 

Below is the reference of grep command

grep command

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. grep command to show lines after and before the keyword
  2. search keyword in file with line number using grep command
  3. How to use grep command to get fixed pattern or exact keyword
  4. grep command to find multiple strings or keyword from file
  5. How to print particular line number by using sed command
  6. How to show line numbers with less command in Linux
  7. sed : find the pattern (keyword) and delete the line from file
  8. grep command to remove blank lines from file
  9. grep command to remove commented lines
  10. Print grep command output without seperator

Filed Under: Tips And Tricks Tagged With: grep

Reader Interactions

Comments

  1. Rick Nelson says

    October 13, 2014 at 11:42 pm

    Exactly what i needed
    Thank you so much

    Reply
    • sharadchhetri says

      October 14, 2014 at 12:07 pm

      Most welcome

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

sed: -e expression #1, char 24: Invalid range end

How to change smtp port number 25 in postfix

How to forcefully send mail from mailq in sendmail MTA

4 Different commands to find system uptime in linux

Convert hyphen to underscore in between all filenames shell script

Forward all incoming emails to other SMTP server or gateway

How to change login banner message in GUI mode in CentOS 6 or above version.

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy