• Skip to primary navigation
  • Skip to main content
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

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

Print grep command output without seperator

July 1, 2015 by Sharad Chhetri

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 output without separator

1. Given below is sample file called test. We are doing this practical with this file, hence suggest you to go through with its content once.

sharad@linuxworld:/tmp$ cat test 
red
blue
green
yellow
black
white
one
four
seven
ten
flower
rose
red
rose
office
blog
red
flower
rose
linux
seven
unix
red
windows
AIX
sharad@linuxworld:/tmp$ 

2. Use --no-group-separator option with grep command.

Syntax :

grep --no-group-separator [Other Options] File-Name

In below given screenshot, you can see the --no-group-separator along with grep command.

grep command

Share this:

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

Related posts:

  1. How to use grep command to get fixed pattern or exact keyword
  2. search keyword in file with line number using grep command
  3. grep command to show lines after and before the keyword
  4. Linux Tac Command : Reverse Of cat Command Output
  5. awk command to print columns from file
  6. How to print particular line number by using sed command
  7. Do not show line haveing particular keyword by grep command
  8. grep command to find multiple strings or keyword from file
  9. grep command to remove blank lines from file
  10. grep command to remove commented lines

Filed Under: Linux Tagged With: grep

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