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

Read Some More Articles

Leave a Reply

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