LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Grep and '-' (https://www.linuxquestions.org/questions/linux-general-1/grep-and-65110/)

Wynd 06-11-2003 11:05 PM

Grep and '-'
 
How can I find lines in a file that begin with a dash? If I just try
Code:

grep -blah
it thinks that I'm trying to pass it the option "-blah". Enclosing it in quotes doesn't work. What can I do?

Wynd 06-11-2003 11:07 PM

nevermind, figured it out

JZL240I-U 06-12-2003 02:39 AM

Quote:

Originally posted by Wynd
nevermind, figured it out
And why don't you post the solution?
:(

cuckoopint 06-12-2003 09:18 PM

man grep


-e PATTERN

Flibble 06-13-2003 05:10 PM

egrep ^-

?

Flibble

Wynd 06-13-2003 05:14 PM

Sorry. Just do:
Code:

grep -e "-blah" [file]
:)


All times are GMT -5. The time now is 12:34 AM.