title: Scripting linux commands to modify data in files
body: <p>I have a series of devices that I need to SSH into, modify some files changing the device name, and network settings.</p>
  
  <p>The files contain data such as:</p>
  
  <pre><code>NETWORK_ETH1_CLIENTIP_LIST='10.47.19.182'
  
  HOSTNAME="c50"
  </code></pre>
  
  <p>I am using putty to ssh in to the system, and then using nano to modify each file.</p>
  
  <p>I believe it would be easy to script but I am not too sure of the linux commands for what I would like to do.</p>
  
  <p>Are there commands in linux I could use that could search for strings within a specified text file, e.g. "HOSTNAME" and replace the found line with the new HOSTNAME?</p>
  
  <p>I am current using plink for some of easier system checks that I call from batch files:</p>
  
  <pre><code>plink.exe -pw PASSWORD USERNAME@192.168.77.77 -m Commands/SystemChecks.txt
  </code></pre>
  
  <p>Username and password have been omitted. SystemChecks contains some basic lookup table and ping commands etc to test if the device was successfully modified.</p>
  
  <p>What I need help with is figuring out a way to find and replace data (hostname, ip address, netmasks etc) using linux commands.</p>