I am trying to read the data from data from txt file. Below is the content of txt file.
google is working
Yahoo is working
curl -s http://google.com | grep -Po 'google is working'
curl -s http://yahoo.com | grep -Po 'Yahoo is working'
curl -s $A | grep -Po $B
Below is a simple
while loop which should provide you with the required solution you are looking for.
while read -r odd_line do echo "Odd line" $odd_line read -r even_line echo "Even line" $even_line curl -s "$odd_line" | grep -Po "even_line" done < temp.txt
How it works
temp.txt is the file which contains you're data. This while loop reads
temp.txt one line at a time. As expected, first line will be odd
odd_line variable will hold odd line. Calling read again inside while loop will read even line. So
even_line variable will contain even line. Once you have both variables define, you can pass them to any command