2

How can i use grep commend with variable ?

  • I stored ' Feb 1 ' (future it will be changeable) to variable 'date'.
  • Now i want to grep this variable 'date', How can i do this ?
Kumar
  • 823
  • 3
  • 20
  • 43

1 Answers1

2

This should work:

DATE='Feb 1'
grep "$DATE" [filename]

You need to put quotes around it because of the space in your variable.

einstiien
  • 2,568
  • 18
  • 18