2

I want to search Terminal output from a command for a string and display only the lines that include that string.

How can I do it?

I'm interested in searching the Terminal output, not a file. I have tried

ls --help | grep '--l '

but that gave me error.

BlueSkies
  • 2,145

1 Answers1

2
command-name | grep 'STRING'

If STRING starts with '-' or '--', it's necessary to utilize one of the following formats:

command-name | grep \\'STRING'
command-name | grep -e 'STRING'
command-name | grep -- 'STRING'
glenn jackman
  • 17,900
BlueSkies
  • 2,145