0

I have included write(*,*) in a large project. Now I want to grep

grep -n 'write(*,*)' response.f

and got nothing found. Why are expressions with parenthesess not suitable for classical grep?

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116
MotaF
  • 605
  • 2
  • 9
  • 22

1 Answers1

3

The parentheses aren't the problem, but * is a regex metacharacter. Try grep -nF to not interpret as a regex:

grep -nF 'write(*,*)' response.f

Or, alternatively, escape:

grep -n 'write(\*,\*)' response.f

Your regex was interpreted as "zero or more (, then zero or more ,, then ).

Benjamin W.
  • 46,058
  • 19
  • 106
  • 116