<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Hello, <br><br>Can kindly someone give me some inputs with an awk issue :<br><br>I have a dummy file that looks like this:<br><br>127.0.0.1 127.0.0.3<br>1.2.3.4   127.0.0.3<br>127.0.0.1 1.2.3.4<br>1.2.3.4   127.0.0.1<br>23.4.5.11 127.0.0.1<br>127.0.0.1 1.1.1.1<br>127.0.0.1 2.2.2.2<br>127.0.0.1 3.3.3.3<br>127.0.0.2<br>127.0.0.1 127.0.0.1<br>127.0.0.1 127.0.0.1<br><br>when I issue the following via the command line: <br><br>root@darkstar:~/r# awk '$1=="127.0.0.1" {print}' test.txt<br><br>I get these results and this is what I'm looking for (correct answer):<br><br>127.0.0.1 127.0.0.3<br>127.0.0.1 1.2.3.4<br>127.0.0.1 1.1.1.1<br>127.0.0.1 2.2.2.2<br>127.0.0.1 3.3.3.3<br>127.0.0.1 127.0.0.1<br>127.0.0.1 127.0.0.1<br><br>However; if I script this in bash such as:<br><br>ip="127.0.0.1"<br><br>awk '$1==$ip {print}' test.txt<br><br>I never get the right results. <br><br>thanks very much for any suggestions or help<br><br>ak<br>                                           </div></body>
</html>