Search code examples
linuxbashgrepechognome-terminal

Add an echo after a grep search


Is there a way to add an echo after a grep command?

For example if I run this:

grep -R $id && echo appearances in database

The output is

listofids.txt:226526658 201
appearances in database

Is there a way to get it to display as such:

listofids.txt:226526658 201 appearances in database

I have tried a few ideas that came to mind but nothing worked, for example :

echo "" grep -R $id "appearances in database"

I knew it wouldn't work but I thought it was worth a shot.


Solution

  • This should do:

    echo "$(grep -R $id) appearances in database"