Hi Guys
I'm trying to grep variable content from file but for some reason it doesn't work.
I have a file , let say with sourceIP%ID,port destinationIP%ID,port :
Code:
$ cat file
1.1.1.1%70:49513 2.2.2.2%40:6400
3.3.3.3%60:51420 4.4.4.4%30:5421
5.5.5.5%50:35784 6.6.6.6%20:5443
7.7.7.7%40:51110 8.8.8.8%10:6420
$ echo $ID
%50
$ grep "$ID" file
$
I just want to grep the $ID from file. (I'm getting the $ID content by some other manipulation)
The thing is, when I'm doing simple assignment of ID="%50" all working properly as below.
Code:
$ ID="%50"
$ grep $ID file
5.5.5.5%50:35784 6.6.6.6%20:5443
can someone help here please ?