Given an input file which consists of lines of IP addresses and strings, how can I loop through each line, and execute a command using the IP address and string?  An example of the command that I want to run for each line is:ssh user@192.168.0.10 cat /etc/component10/version | grep 'Version\|Project' >> /tmp/component_ver.txtAssume that a password is not required.  I would like the script to be robust enough to answer yes if the ...(yes/no)? prompt is encountered during login.Sample INPUT file:192.168.0.10 component10  192.168.0.20 component20  192.168.0.30 component30  
How to read input file and act on each line
command line
The following code will do what you want.while read -r server _; do ssh -n -o StrictHostKeyChecking=no root@$server grep -E 'Version|Project' /etc/component10/version >> /tmp/component_ver.txt; done < serverfile