title: bash script use cut command at variable and store result at another variable
body: <p>I have a <em>config.txt</em> file with IP addresses as content like this</p>
  
  <pre><code>10.10.10.1:80
  10.10.10.13:8080
  10.10.10.11:443
  10.10.10.12:80
  </code></pre>
  
  <p>I want to <em>ping every ip</em> address in that file</p>
  
  <pre><code>#!/bin/bash
  file=config.txt
  
  for line in `cat $file`
  do
    ##this line is not correct, should strip :port and store to ip var
    ip=$line|cut -d\: -f1
    ping $ip
  done
  </code></pre>
  
  <p>I'm a beginner, sorry for such a question but I couldn't find it out myself.</p>