title: AWK equivalent in windows batch script
body: <p>I have a file test.txt as</p>
  
  <pre><code>:ROOM1: :CITY: :2000:
  :ROOM2: :RURAL: :1500:
  :ROOM3: :CITY: :3000:
  </code></pre>
  
  <p>I need to get the last word based on the first and second word. I made it in Unix using AWK:</p>
  
  <pre><code>cat get_room_rent.ksh
  #!/bin/ksh
  FILE_NAME=test.ksh
  awk -F: '{ if ($2 == room_name &amp;&amp; $4 == type) {print $6} }' room_name=$1 type=$2 $ROOM_RENT
  echo ${ROOM_RENT}
  </code></pre>
  
  <p>Running above script</p>
  
  <pre><code>RM_RNT=`./get_room_rent.ksh ROOM2 RURAL`
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>1500
  </code></pre>
  
  <p>I need to make the same in a Windows batch file... I would not be installing an AWK Windows version.</p>
  
  <p>I tried something like the below, but I had no luck...</p>
  
  <pre><code>FOR /F "tokens=%ROOM2% delims=:" %%G IN (C:test.txt) DO echo Chosen word is: %%G&amp;goto nextline
  :nextline
  
  set showme=Y
  FOR /F "tokens=%ROOM2% delims=:" %%G IN (c:test.txt) DO if defined showme set showme=&amp;echo Chosen word is: %%G
  </code></pre>