Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Grep

Status
Not open for further replies.

kellert

Technical User
May 1, 2003
1
US
Using grep, how do I search the file t.txt for the string -6 ?
 
grep -- -6 t.txt
The -- means "end of options", so anything with a leading minus after that is NOT treated as an option
 
Alternatively, grep '\-6' test, the \ meaning 'treat the following as a normal character'. Cheers.
 
Oops. Replace test above with t.txt for it to work with your example.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top