(English isnt my native lang feel free to ask is something reads strange)
**** This question is deprecated due to the nesting properties of HTML and the risk to lead to memory and IO issues thanks stackoverflow team for the link to other forms to solve it, @Rojo and @boreddad420 for the comments, i will kept this question to serve as a guide to another users ******
Hi, Im working on a linux script (.sh
) to retrieve info from code generated from a curl call, it got results from a given number of pages of a catalog,i save the code into a variable, and then planning using a regex to get from the variable all <li>
inside a given <ul class="output">
, then inside each <li>
i need to "iterate" a search to locate some data ex. <span itemname="plasticcup">
<- item name changes , that data will be append as output on a csv (separated by commas)
Im not very good with regex, I need some advice specially with the class or itemname how can i define it on the regex exp?, It could be done using regex or its better to figure out a solution using a nested loop?
I tried to use some regex expresions but ended messing up the result, more because I got confused defining the class name and how using the "
or '
inside the regex, i expect to retrieve the data and "packed" it separated with commas on a file, the main loop to get the given numbers of url into a variable and the output file is done, but obviously the output file isnt a comma separated is html code