Note that there are some explanatory texts on larger screens.

plurals
  1. POPython extract text data in dynamic text format
    text
    copied!<p>I have very large text files that has the format below:</p> <pre><code>items=item1|item2|item3|item4&amp;ids=18|117|34|315&amp;locations=5|26|9|12#Characteristic_1#Describe Characteristic_1#http://example.com items=item1|item2|item3|item4&amp;ids=18|117|34|315&amp;locations=5|26|9|12#Characteristic_2#Describe Characteristic_2#http://example.com items=item1|item2|item3|item4&amp;ids=18|117|34|315&amp;locations=5|26|9|12#Characteristic_3#Describe Characteristic_3#http://example.com </code></pre> <p>The number of items, ids and locations is not fixed, it has 4 value above, but it also has 1,2,3 or 5, 6 value like below example:</p> <pre><code>items=item1&amp;ids=18&amp;locations=5#Characteristic_1#Describe Characteristic_1#http://example.com items=item1|item2&amp;ids=18|117&amp;locations=5|26#Characteristic_1#Describe Characteristic_1#http://example.com items=item1|item2|item3&amp;ids=18|117|34&amp;locations=5|26|9#Characteristic_3#Describe Characteristic_1#http://example.com </code></pre> <p>What I want to get from this data is the item name and its id, also its location. Like below format:</p> <pre><code>item1,18,5 item2,117,26 item3,34,9 item4,315,12 </code></pre> <p>I have tried to use split("|") function to get the value out of string, but i don't figure out:</p> <ol> <li>How to deal with the dynamic number of items exists in the string and</li> <li>How to match the value to each other accordingly.</li> </ol> <p>Any help will be appreciated.</p> <p>Thank you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload