0

I'm trying to use grep to find the string "init()" in all the files that end in .js in a directory.

I tried this

grep "init()" *.js

but it didn't work. Why not? What's the correct way to do this?

1 Answer 1

4

Try escaping the parentheses: grep "init\(\)" *.js

It is actually a regular expression, where ( and ) are special characters.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.