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.
  • 38,596
  • 16
  • 96
  • 104
MotaF
  • 595
  • 2
  • 7
  • 21

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.
  • 38,596
  • 16
  • 96
  • 104