0

When I run below command, the "awk" changes my ip unexpectedly. I could not find how to fix this. Regards.

echo $ip
10.165.6.90

cat text.txt | grep STRING | awk -F'[. ="]' '{print '$ip' ";" $10 ";" $15}'
10.1650.60.9;163840000;X
10.1650.60.9;232525824;Y
10.1650.60.9;232526848;X
10.1650.60.9;232529920;Z
10.1650.60.9;232530944;T
Eyvz
  • 13
  • 2
  • 1
    In order to qualify as a [mcve], the code would need to let someone see the problem themselves without having your `test.txt`. – Charles Duffy Apr 17 '18 at 22:06
  • 1
    ...that said, in general, we already have Q&A entries telling you the right way to pass variables into awk, which this isn't. `awk -v ip="$ip" -F'[. ="]' '{print ip ";" $10 ";" $15}'` – Charles Duffy Apr 17 '18 at 22:07
  • Thx charles for your flash speed response. I really made my research here, but I am new for this codes so could not put all info's together I guess :) Thx again it worked great. – Eyvz Apr 17 '18 at 22:20

0 Answers0