I am extracting information from a website. I designed the code in VBA and found that it is taking too long to execute. So, I have decided to rewrite the code in Unix script. I am extracting a page information using
curl command as below.
Now, the variable
$page contains the entire page contents in a HTML format. I am looking for a particular div class in the web page.
I use the grep command as below.
output=$("$page"|grep "div class=\"my_class_name\"")
If I just use
echo "$page"|grep "div class=\"my_class_name\"" I get the contents of div in the echo statement. However, as above when am trying to save it in a variable and printing, I am getting the entire HTML page contents as output.
I just need to check if the pattern
"div class=\"my_class_name\" occurs in the page.