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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I disable regex in grep? 1

Status
Not open for further replies.

cpjust

Programmer
Sep 23, 2003
2,132
US
Hi,
I'm wondering if there is any kind of switch to disable regex in grep? I couldn't see anything obvious in the man page.

I'm writing a script that greps for a certain string in a file and if it's not there, it adds it; but the string contains asterisks which grep considers wild cards. So right now I need to set 2 variables to the same string, except one has the * chars escaped so grep doesn't think of them as wildcards.

For simplicity & maintainability it would be nice if I could just use the same variable in the grep as I do when appending the string to the file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top