4

How can I use 'grep' to get lines start with '* ' in my file?

I tried grep "*" myfile and grep "* " myfile but returns all the lines of my file.

11

The "*" is a special character that means "0 or more of the previous character." You need to escape this character.

grep '^\*' myfile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.