Tag: grep

  • Print grep command output without seperator

    Print grep command output without seperator

    I am working with grep command and found two dashes ( — ) in output. How can I print grep command output without two dashes ( — ) that is also called separator. Answer : To print grep command output without separator , you can use the option –no-group-separator with grep command. How to print […]

  • grep command to remove commented lines

    grep command to remove commented lines

    In this post we will learn how to use grep command to remove commented lines. We can also use egrep command which is extended form of grep command. As a Linux System Engineer, I mostly use some of the command. Most of the time when I am busy in playing on system, I generally meet […]

  • grep command to remove blank lines from file

    grep command to remove blank lines from file

    FAQ : How to use grep command to remove blank lines from file Answer: To remove the blank lines from file, use the given below syntax grep -v ‘^$’ /path/of/file-name In above command, -v = Invert the sense of matching, to select non-matching lines ^$ = It is regex. ^ means start with and $ […]

  • grep command to find multiple strings or keyword from file

    grep command to find multiple strings or keyword from file

    This post explains about grep command to find multiple strings or keyword from file. In Linux or Unix like operating system, the grep command utility is widely used. Grep is a command-line utility for searching plain-text data sets for lines matching a regular expression. Grep was originally developed for the Unix operating system, but is […]

  • grep command to show lines after and before the keyword

    grep command to show lines after and before the keyword

    In this post,I am sharing a useful option with linux grep command.In this tutorial, we will use grep command to show lines after and before the keyword . As a Linux System Engineer, sometimes I get the requirement to print lines above and below of a particular keyword in the file. Generally if you only […]

  • search keyword in file with line number using grep command

    search keyword in file with line number using grep command

    grep command which is used for searching the keyword in file and show its output as lines containing a match to the given PATTERN or Keyword. When we simply use grep command without using any switches it simply shows the output with line having the keyword.Today,in this post we will know about a small tip […]