termvector counting keywords in Elasticsearch - elasticsearch

I am using elasticsearch 1.5.2.
I want to get the number of time that every keyword is repeated on a stored products in my index.
keywords are : sauces, crèmes, gâteaux.
these are my products:
POST test/prod
{
"titre": "product 1",
"catégorie": "Epicerie",
"informations": "Sauces, potages, crèmes & gâteaux. / Composé exclusivement d'amidon de maïs, il vous permet d'alléger vos gâteaux et crêpes ou bien d'épaissir vos sauces, soupes et crèmes. Il rend vos desserts onctueux et légers : il suffit simplement de remplacer la moitié de votre farine par la fécule de maïs. // Poids net : 0,400 kg // Veuillez contacter notre responsable de mise en marché : Distribué par Système U - BP 30159 - 94533 Rungis cedex"
}
POST test/prod
{
"titre": "product 2",
"catégorie": "Fruits",
"informations": "A conserver dans un endoit frais et sec. Idée recette: Madeleines fourrées au chocolat Ingrédients (pour une vingtaine de madeleines) : 100g de farine, 90g fécule de maïs,1 sachet de levure, 3 oeufs,125g de sucre,190g de beurre,1cuillère à soupe d'eau de fleur d'oranger, 1 vingtaine de carrés de chocolat Préparation : Mélangez la farine, la fécule et la levure. Ajoutez le sucre et les oeufs battus. Faites fondre le beurre à feu doux et incorporer le au précédent mélange. Mélangez bien et laissez reposer la pâte une heure au réfrigérateur. Préchauffez le four à 220°C. Beurrez les moules à madeleine, garnissez les moules de moitié, ajoutez au centre un petit carré de chocolat et recouvrez de l'appareil à madeleine. Enfournez pour 5 minutes puis baissez le four à 180°C et poursuivez la cuisson 5 minutes. Sortez les madeleines, laissez-les tiédir et démoulez-les."
}
I want to get a result in order desc like this for example:
product 1:
sauces repeated :9
crèmes repeated :8
gâteaux repeated: 2
product 2:
sauces repeated :8
crèmes repeated :6
gâteaux repeated: 4
I used termvector in only one field, however I want to get the result from all document. It was like this:
POST test/prod/1/_termvector
{
"fields" : ["informations"],
"offsets" : true,
"payloads" : true,
"positions" : true,
"term_statistics" : true,
"field_statistics" : true
}
But I get as a result a very long list which contains all words in this field. I want only as a result my 3 keywords.

Related

Controle de vagas de estacionamento usando pilhas e filas [closed]

Closed. This question is not written in English. It is not currently accepting answers.
Stack Overflow is an English-only site. The author must be able to communicate in English to understand and engage with any comments and/or answers their question receives. Don't translate this post for the author; machine translations can be inaccurate, and even human translations can alter the intended meaning of the post.
Closed 2 days ago.
Improve this question
Fa¸ca uma classe que fa¸ca o controle de um estacionamento com capacidade para 10 carros. Essa classe
deve ser controlada por um menu (rodando em loop) que permita ao usu´ario:
• Adicionar um novo carro. Nesse caso o usu´ario deve fornecer o n´umero da vaga e a placa do carro.
Caso a vaga esteja livre o carro dever´a ser colocado na vaga, caso contr´ario, o usu´ario dever´a ser
informado;
• Liberar um novo carro. O usu´ario dever´a fornecer um n´umero de vaga e a placa daquela vaga
dever´a ser retirada;
• Verificar status. Deve retornar a ocupa¸c˜ao atual do estacionamento no formato ”n´umero da vaga
Placa do carro” para as vagas ocupadas ou ”n´umero da vaga - Vazio” para as vagas vazias;
• Sair do programa.
alguem pode me ajudar com este exercicio? estou com dificuldades
estou usando metedo de pilhas para este, mais nao consigo localizar uma vaga vazia, e nao consigo tirar um veiculo da vaga

HMTLUnit how to get IMG url in javascript?

For HTMLunit prof here, can you tell if it's possible to get each url present in a javascript code.
For example, in this code, i'd like to get each ".jpg" url :
I mean, alle images in "photos" variable.
Thank you for your help
<script ngappstate>var ngAppState = {"advertising":{"triggerImbvpjs":false},"authentication":{"isBusy":false},"property":{"estate":{"id":8345497,"publisherId":785672,"pubDate":"2019-09-17T10:08:13.000+02:00","photos":["https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_1.jpg?cache=2019091009047","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_2.jpg?cache=2019091009097","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_3.jpg?cache=2019091009330","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_4.jpg?cache=2019091009330","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_5.jpg?cache=2019091009657","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_6.jpg?cache=2019091009737","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_7.jpg?cache=2019091009843","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_8.jpg?cache=2019091009953","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_9.jpg?cache=2019091009017","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_A.jpg?cache=2019091009093","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_B.jpg?cache=2019091009233","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_C.jpg?cache=2019091009453","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_D.jpg?cache=2019091009467","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_E.jpg?cache=2019091009467","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_F.jpg?cache=2019091009560","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_G.jpg?cache=2019091009467","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_H.jpg?cache=2019091009717","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_I.jpg?cache=2019091009717","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_J.jpg?cache=2019091009717","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_K.jpg?cache=2019091009873","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_L.jpg?cache=2019091009907"],"picturesResized":[{"lastModificationDate":"2019-09-17T10:09:19.080+02:00","ordering":1,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_1.jpg?cache=2019091009047","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_1.jpg?cache=2019091009080","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_1.gif?cache=2019091009080","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.110+02:00","ordering":2,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_2.jpg?cache=2019091009097","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_2.jpg?cache=2019091009110","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_2.gif?cache=2019091009110","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.330+02:00","ordering":3,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_3.jpg?cache=2019091009330","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_3.jpg?cache=2019091009330","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_3.gif?cache=2019091009347","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.347+02:00","ordering":4,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_4.jpg?cache=2019091009330","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_4.jpg?cache=2019091009347","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_4.gif?cache=2019091009423","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.673+02:00","ordering":5,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_5.jpg?cache=2019091009657","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_5.jpg?cache=2019091009673","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_5.gif?cache=2019091009673","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.737+02:00","ordering":6,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_6.jpg?cache=2019091009737","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_6.jpg?cache=2019091009737","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_6.gif?cache=2019091009750","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.843+02:00","ordering":7,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_7.jpg?cache=2019091009843","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_7.jpg?cache=2019091009843","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_7.gif?cache=2019091009860","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.970+02:00","ordering":8,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_8.jpg?cache=2019091009953","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_8.jpg?cache=2019091009970","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_8.gif?cache=2019091009983","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.030+02:00","ordering":9,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_9.jpg?cache=2019091009017","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_9.jpg?cache=2019091009030","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_9.gif?cache=2019091009047","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.110+02:00","ordering":11,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_A.jpg?cache=2019091009093","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_A.jpg?cache=2019091009110","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_A.gif?cache=2019091009110","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.250+02:00","ordering":12,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_B.jpg?cache=2019091009233","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_B.jpg?cache=2019091009250","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_B.gif?cache=2019091009453","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.467+02:00","ordering":13,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_C.jpg?cache=2019091009453","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_C.jpg?cache=2019091009467","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_C.gif?cache=2019091009547","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.467+02:00","ordering":14,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_D.jpg?cache=2019091009467","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_D.jpg?cache=2019091009467","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_D.gif?cache=2019091009657","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.467+02:00","ordering":15,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_E.jpg?cache=2019091009467","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_E.jpg?cache=2019091009467","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_E.gif?cache=2019091009717","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.467+02:00","ordering":16,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_F.jpg?cache=2019091009560","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_F.jpg?cache=2019091009467","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_F.gif?cache=2019091009717","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.467+02:00","ordering":17,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_G.jpg?cache=2019091009467","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_G.jpg?cache=2019091009467","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_G.gif?cache=2019091009717","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.873+02:00","ordering":18,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_H.jpg?cache=2019091009717","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_H.jpg?cache=2019091009873","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_H.gif?cache=2019091009907","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.873+02:00","ordering":19,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_I.jpg?cache=2019091009717","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_I.jpg?cache=2019091009873","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_I.gif?cache=2019091009907","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.873+02:00","ordering":20,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_J.jpg?cache=2019091009717","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_J.jpg?cache=2019091009873","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_J.gif?cache=2019091009907","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.907+02:00","ordering":21,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_K.jpg?cache=2019091009873","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_K.jpg?cache=2019091009907","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_K.gif?cache=2019091009907","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.907+02:00","ordering":22,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_L.jpg?cache=2019091009907","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_L.jpg?cache=2019091009907","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_L.gif?cache=2019091009920","pictureOrientation":"LANDSCAPE"}],"flags":{"new":true,"defaultOrderingScore":1,"priceOrderingScore":279000,"dateOrderingScore":"2019-09-17T10:08:13.657+02:00","pricem2orderScore":0,"adQualityScore":90.87},"adType":"M","energy":{"energyConsumption":495,"yearlyTheoreticalTotalEnergyConsumption":109187,"EPCScore":"F","CO2emission":null,"EPCreferenceNumber":"20190811002958","Heating":"Gas","doubleGlazing":true,"epcreferenceNumber":"20190811002958"},"media":[{"type":"VIRTUAL_TOUR","content":{"value":"https://my.matterport.com/show/?m=jXVimgXaXwY&lang=fr&help=2&lp=1&hl=0&ts=1&st=5000&guides=0&qs=1' f"}}],"mainType":"HOUSE","subtype":"HOUSE","geographical":{"geo":{"latitude":50.4037765,"longitude":4.395336},"geoPoint":{"latitude":50.4037765,"longitude":4.395336},"hasSeaView":false,"postal":{"country":"BE","province":"Hainaut","district":"Charleroi","locality":"Montigny-le-Tilleul","postalcode":"6110","street":"Rue de Cartier","number":"56","box":"","buildingName":"","region":"WALLONIE"},"postalAddr":{"country":"BE","province":"Hainaut","district":"Charleroi","locality":"Montigny-le-Tilleul","postalcode":"6110","street":"Rue de Cartier","number":"56","box":"","buildingName":"","region":"WALLONIE"}},"buyRent":"BUY","transactionSubtype":"BUY_REGULAR","activationStatus":"CODE_STATUS_ACTIVATED","description":{"title":"Magnifique maison de maitre 4 façades entièrement rénovée, 4","description":"!!!Rue de Cartier 56 Commune de Marchienne - au - Pont!!! https://www.youtube.com/watch?v=k_pd8XSxgoE ou n'hésitez pas à cliquer sur l'onglet MEDIA (sur la première photo) pour une visite virtuelle interactive. VISITES ET RENSEIGNEMENTS AU 0487 34 34 83 - Magnifique maison de maitre 4 façades entièrement rénovée, 4 chambres avec jardin. Comprenant caves, hall d'entrée, living, cuisine, bureau, salle de bains avec wc, double vasques, baignoire, douche italienne. 1°: hall de nuit, deux chambres. Au 2°: hall de nuit, deux chambres. Chauffage central au gaz, châssis TV PVC, plancher béton à tous les niveaux, cuisine Ducati prix d'achat 56.000€, alarme, adoucisseur d'eau. FAIRE OFFRE A PARTIR DE 279.000€. DESCRIPTIF COMPLET SUR LE","moreInfo":"WWW.LOPPORTUNITE.BE A TITRE INFORMATIF ET NON CONTRACTUEL."},"general":{"netFloorArea":220,"frontageNumber":4,"buildingCondition":"JUST_RENOVATED","availability":""},"interior":{"bedrooms":4,"bathroomNumber":1,"toiletsNumber":1,"kitchenSetup":"Installed","cellarProperty":true},"buildingRegulation":{"planningPermissionObtained":"NOT_SPECIFIED","asBuiltPlan":"NO","subdivisionPermit":"NOT_SPECIFIED","possiblePriorityPurchaseRight":"NOT_SPECIFIED","proceedingsForBreachOfPlanningRegulations":"NOT_SPECIFIED","floodZoneInfo":null},"financial":{"vatProfile":"VAT_INCLUDED","salePrice":279000,"cadastralIncome":803,"priceBasedOn":false,"isMinimumBid":false,"isPriceBased":false},"soldInfo":{"sold":false,"soldLabel":"NO_LABEL"},"contactInfo":{"phone":"+3271799549","email":"lopportunite#omniwebsites.be","mobile":"","idclient":785672,"clientType":"AGE","title":"L' OPPORTUNITE","location":{"geo":{"latitude":50.4115438,"longitude":4.381455},"geoPoint":{"latitude":50.4115438,"longitude":4.381455},"postal":{"country":"BE","province":"Hainaut","district":"Charleroi","locality":"Monceau-sur-sambre","postalcode":"6031","street":"Rue des Combattants 37","number":"","box":"","region":"WALLONIE"},"postalAddr":{"country":"BE","province":"Hainaut","district":"Charleroi","locality":"Monceau-sur-sambre","postalcode":"6031","street":"Rue des Combattants 37","number":"","box":"","region":"WALLONIE"}},"logo":"https://static.immoweb.be/logos/785672.gif?cache=2017061204440","www":"http://www.lopportunite.be","ipiNo":"503906","referenceWithinSoftware":"2655","referenceWithinAgency":"2655 - 868","responsible":""},"land":{"surfaceAreaOfPlot":230}},"publishers":[{"id":785672,"ipiNo":"503906","geoPoint":{"latitude":50.4115438,"longitude":4.381455},"name":"L' OPPORTUNITE","logoUri":"https://static.immoweb.be/logos/785672.gif?cache=2017061204440","email":"lopportunite#omniwebsites.be","phones":["+3271799549"],"address":"Rue des Combattants 37","zip":6031,"locality":"Monceau-sur-sambre","description":{"text":"Nous vendons rapidement votre maison, appartement, immeuble de rapport, terrain,… et ce au meilleur prix.\r\n\r\n- ESTIMATION DE VOTRE BIEN\r\n- SERVICE PERSONNALISE A NOTRE CLIENTELE\r\n- MISSION DE VENTE CLAIRE ET PRECISE\r\n- PUBLICITE CIBLEE, VISITES ORGANISEES","language":"fr"},"timetable":{},"contactHours":"MT","contactHoursGsm":"MT","emails":[{"contactInformation":"lopportunite#omniwebsites.be","usage":"DEFAULT"}],"landLines":[{"contactInformation":"+3271799549","usage":"DEFAULT"}],"faxMachines":[{"contactInformation":"+3271315405","usage":"DEFAULT"}],"country":"be"}],"media":null,"status":1}};</script>
You wouldnt do something like that with htmlunit. Instead use Regular Expressions to search for those links. You can use this regular expression for the task: (http([a-zA-Z\/:\.0-9_]*)?.jpg). The example looks like this:
var reg= /(http([a-zA-Z\/:\.0-9_]*)?.jpg)/g;
var ngAppState = {"advertising":{"triggerImbvpjs":false},"authentication":{"isBusy":false},"property":{"estate":{"id":8345497,"publisherId":785672,"pubDate":"2019-09-17T10:08:13.000+02:00","photos":["https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_1.jpg?cache=2019091009047","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_2.jpg?cache=2019091009097","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_3.jpg?cache=2019091009330","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_4.jpg?cache=2019091009330","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_5.jpg?cache=2019091009657","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_6.jpg?cache=2019091009737","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_7.jpg?cache=2019091009843","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_8.jpg?cache=2019091009953","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_9.jpg?cache=2019091009017","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_A.jpg?cache=2019091009093","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_B.jpg?cache=2019091009233","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_C.jpg?cache=2019091009453","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_D.jpg?cache=2019091009467","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_E.jpg?cache=2019091009467","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_F.jpg?cache=2019091009560","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_G.jpg?cache=2019091009467","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_H.jpg?cache=2019091009717","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_I.jpg?cache=2019091009717","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_J.jpg?cache=2019091009717","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_K.jpg?cache=2019091009873","https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_L.jpg?cache=2019091009907"],"picturesResized":[{"lastModificationDate":"2019-09-17T10:09:19.080+02:00","ordering":1,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_1.jpg?cache=2019091009047","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_1.jpg?cache=2019091009080","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_1.gif?cache=2019091009080","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.110+02:00","ordering":2,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_2.jpg?cache=2019091009097","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_2.jpg?cache=2019091009110","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_2.gif?cache=2019091009110","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.330+02:00","ordering":3,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_3.jpg?cache=2019091009330","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_3.jpg?cache=2019091009330","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_3.gif?cache=2019091009347","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.347+02:00","ordering":4,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_4.jpg?cache=2019091009330","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_4.jpg?cache=2019091009347","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_4.gif?cache=2019091009423","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.673+02:00","ordering":5,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_5.jpg?cache=2019091009657","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_5.jpg?cache=2019091009673","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_5.gif?cache=2019091009673","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.737+02:00","ordering":6,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_6.jpg?cache=2019091009737","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_6.jpg?cache=2019091009737","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_6.gif?cache=2019091009750","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.843+02:00","ordering":7,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_7.jpg?cache=2019091009843","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_7.jpg?cache=2019091009843","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_7.gif?cache=2019091009860","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:19.970+02:00","ordering":8,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_8.jpg?cache=2019091009953","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_8.jpg?cache=2019091009970","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_8.gif?cache=2019091009983","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.030+02:00","ordering":9,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_9.jpg?cache=2019091009017","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_9.jpg?cache=2019091009030","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_9.gif?cache=2019091009047","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.110+02:00","ordering":11,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_A.jpg?cache=2019091009093","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_A.jpg?cache=2019091009110","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_A.gif?cache=2019091009110","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.250+02:00","ordering":12,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_B.jpg?cache=2019091009233","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_B.jpg?cache=2019091009250","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_B.gif?cache=2019091009453","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.467+02:00","ordering":13,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_C.jpg?cache=2019091009453","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_C.jpg?cache=2019091009467","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_C.gif?cache=2019091009547","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.467+02:00","ordering":14,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_D.jpg?cache=2019091009467","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_D.jpg?cache=2019091009467","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_D.gif?cache=2019091009657","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.467+02:00","ordering":15,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_E.jpg?cache=2019091009467","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_E.jpg?cache=2019091009467","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_E.gif?cache=2019091009717","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.467+02:00","ordering":16,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_F.jpg?cache=2019091009560","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_F.jpg?cache=2019091009467","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_F.gif?cache=2019091009717","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.467+02:00","ordering":17,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_G.jpg?cache=2019091009467","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_G.jpg?cache=2019091009467","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_G.gif?cache=2019091009717","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.873+02:00","ordering":18,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_H.jpg?cache=2019091009717","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_H.jpg?cache=2019091009873","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_H.gif?cache=2019091009907","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.873+02:00","ordering":19,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_I.jpg?cache=2019091009717","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_I.jpg?cache=2019091009873","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_I.gif?cache=2019091009907","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.873+02:00","ordering":20,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_J.jpg?cache=2019091009717","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_J.jpg?cache=2019091009873","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_J.gif?cache=2019091009907","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.907+02:00","ordering":21,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_K.jpg?cache=2019091009873","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_K.jpg?cache=2019091009907","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_K.gif?cache=2019091009907","pictureOrientation":"LANDSCAPE"},{"lastModificationDate":"2019-09-17T10:09:20.907+02:00","ordering":22,"pictureFormatLarge":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_L.jpg?cache=2019091009907","pictureFormatMedium":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/M_8345497_L.jpg?cache=2019091009907","pictureFormatSmall":"https://static.immoweb.be/photos/0/8/3/4/5/4/9/7/8345497_L.gif?cache=2019091009920","pictureOrientation":"LANDSCAPE"}],"flags":{"new":true,"defaultOrderingScore":1,"priceOrderingScore":279000,"dateOrderingScore":"2019-09-17T10:08:13.657+02:00","pricem2orderScore":0,"adQualityScore":90.87},"adType":"M","energy":{"energyConsumption":495,"yearlyTheoreticalTotalEnergyConsumption":109187,"EPCScore":"F","CO2emission":null,"EPCreferenceNumber":"20190811002958","Heating":"Gas","doubleGlazing":true,"epcreferenceNumber":"20190811002958"},"media":[{"type":"VIRTUAL_TOUR","content":{"value":"https://my.matterport.com/show/?m=jXVimgXaXwY&lang=fr&help=2&lp=1&hl=0&ts=1&st=5000&guides=0&qs=1' f"}}],"mainType":"HOUSE","subtype":"HOUSE","geographical":{"geo":{"latitude":50.4037765,"longitude":4.395336},"geoPoint":{"latitude":50.4037765,"longitude":4.395336},"hasSeaView":false,"postal":{"country":"BE","province":"Hainaut","district":"Charleroi","locality":"Montigny-le-Tilleul","postalcode":"6110","street":"Rue de Cartier","number":"56","box":"","buildingName":"","region":"WALLONIE"},"postalAddr":{"country":"BE","province":"Hainaut","district":"Charleroi","locality":"Montigny-le-Tilleul","postalcode":"6110","street":"Rue de Cartier","number":"56","box":"","buildingName":"","region":"WALLONIE"}},"buyRent":"BUY","transactionSubtype":"BUY_REGULAR","activationStatus":"CODE_STATUS_ACTIVATED","description":{"title":"Magnifique maison de maitre 4 façades entièrement rénovée, 4","description":"!!!Rue de Cartier 56 Commune de Marchienne - au - Pont!!! https://www.youtube.com/watch?v=k_pd8XSxgoE ou n'hésitez pas à cliquer sur l'onglet MEDIA (sur la première photo) pour une visite virtuelle interactive. VISITES ET RENSEIGNEMENTS AU 0487 34 34 83 - Magnifique maison de maitre 4 façades entièrement rénovée, 4 chambres avec jardin. Comprenant caves, hall d'entrée, living, cuisine, bureau, salle de bains avec wc, double vasques, baignoire, douche italienne. 1°: hall de nuit, deux chambres. Au 2°: hall de nuit, deux chambres. Chauffage central au gaz, châssis TV PVC, plancher béton à tous les niveaux, cuisine Ducati prix d'achat 56.000€, alarme, adoucisseur d'eau. FAIRE OFFRE A PARTIR DE 279.000€. DESCRIPTIF COMPLET SUR LE","moreInfo":"WWW.LOPPORTUNITE.BE A TITRE INFORMATIF ET NON CONTRACTUEL."},"general":{"netFloorArea":220,"frontageNumber":4,"buildingCondition":"JUST_RENOVATED","availability":""},"interior":{"bedrooms":4,"bathroomNumber":1,"toiletsNumber":1,"kitchenSetup":"Installed","cellarProperty":true},"buildingRegulation":{"planningPermissionObtained":"NOT_SPECIFIED","asBuiltPlan":"NO","subdivisionPermit":"NOT_SPECIFIED","possiblePriorityPurchaseRight":"NOT_SPECIFIED","proceedingsForBreachOfPlanningRegulations":"NOT_SPECIFIED","floodZoneInfo":null},"financial":{"vatProfile":"VAT_INCLUDED","salePrice":279000,"cadastralIncome":803,"priceBasedOn":false,"isMinimumBid":false,"isPriceBased":false},"soldInfo":{"sold":false,"soldLabel":"NO_LABEL"},"contactInfo":{"phone":"+3271799549","email":"lopportunite#omniwebsites.be","mobile":"","idclient":785672,"clientType":"AGE","title":"L' OPPORTUNITE","location":{"geo":{"latitude":50.4115438,"longitude":4.381455},"geoPoint":{"latitude":50.4115438,"longitude":4.381455},"postal":{"country":"BE","province":"Hainaut","district":"Charleroi","locality":"Monceau-sur-sambre","postalcode":"6031","street":"Rue des Combattants 37","number":"","box":"","region":"WALLONIE"},"postalAddr":{"country":"BE","province":"Hainaut","district":"Charleroi","locality":"Monceau-sur-sambre","postalcode":"6031","street":"Rue des Combattants 37","number":"","box":"","region":"WALLONIE"}},"logo":"https://static.immoweb.be/logos/785672.gif?cache=2017061204440","www":"http://www.lopportunite.be","ipiNo":"503906","referenceWithinSoftware":"2655","referenceWithinAgency":"2655 - 868","responsible":""},"land":{"surfaceAreaOfPlot":230}},"publishers":[{"id":785672,"ipiNo":"503906","geoPoint":{"latitude":50.4115438,"longitude":4.381455},"name":"L' OPPORTUNITE","logoUri":"https://static.immoweb.be/logos/785672.gif?cache=2017061204440","email":"lopportunite#omniwebsites.be","phones":["+3271799549"],"address":"Rue des Combattants 37","zip":6031,"locality":"Monceau-sur-sambre","description":{"text":"Nous vendons rapidement votre maison, appartement, immeuble de rapport, terrain,… et ce au meilleur prix.\r\n\r\n- ESTIMATION DE VOTRE BIEN\r\n- SERVICE PERSONNALISE A NOTRE CLIENTELE\r\n- MISSION DE VENTE CLAIRE ET PRECISE\r\n- PUBLICITE CIBLEE, VISITES ORGANISEES","language":"fr"},"timetable":{},"contactHours":"MT","contactHoursGsm":"MT","emails":[{"contactInformation":"lopportunite#omniwebsites.be","usage":"DEFAULT"}],"landLines":[{"contactInformation":"+3271799549","usage":"DEFAULT"}],"faxMachines":[{"contactInformation":"+3271315405","usage":"DEFAULT"}],"country":"be"}],"media":null,"status":1}};
var text = JSON.stringify(ngAppState);
while((result = reg.exec(text)) !== null) {
console.log(result[0]);
}

Explanation of error using "color" in a batch script

In order to set the color of a batch script's console/terminal, color can be used. E.g. color 70. However, in order to reset the color of a the console, color without any arguments/values can be used. What is causing confusion for me is why it only works inside the command prompt or a called script but not a script started specifically with cmd /c. It fails and returns an errorcode of 1. Is there some legacy reason for this or is it a bug in Windows?
cmd /c color || echo foobar
Output: foobar
Expected output:
cmd /c color 70 || echo foobar
Output:
Expected output:
call color || echo foobar
Output:
Expected output:
To have no error, try to put the default color, as you said,
the color of a the console
That means the default color, I gess, so put color 07, to switch to color black-light grey.
For more info for colors in a .bat file create a .bat file and put in it color h, only this, save it and run it. It will give you all the info about colors.
If you are not able to do this, here is what it will show you. (Sorry, it's in french, but I gess you can understand)
Change les couleurs par défaut du premier et de l'arrière plan de la console.
COLOR [attr]
attr Spécifie les attributs de couleurs de l'apparence de la console
Les attributs de couleurs sont spécifiés par DEUX chiffres hexadécimaux -- le
premier correspond à l'arrière plan, le second au premier plan. Chaque chiffre
peut prendre n'importe quelle de ces valeurs :
0 = Noir 8 = Gris
1 = Bleu foncé 9 = Bleu clair
2 = Vert A = Vert clair
3 = Bleu-gris B = Cyan
4 = Marron C = Rouge
5 = Pourpre D = Rose
6 = Kaki E = Jaune
7 = Gris clair F = Blanc
Si aucun argument n'est donné, cette commande restaure les couleurs
sélectionnées au moment où CMD.EXE a été ouvert. Cette valeur vient soit de la
fenêtre de la console, du commutateur en ligne de commande /T, ou de la valeur
DefaultColor du registre.
Appuyez sur une touche pour continuer...
Again, sorry that is in french
Kalolol

AWK: Compare two files and calculate a percentage based on differences

I have two files as these..
What I need is to count the number of times each ID appears on each file and calculate the difference to obtain percentage of success. Furthermore, when the third column of the first file contains the word NONE and the same column of the second file contains a number, indicate that has been obtained category for that ID.
File 1:
ID;Coments;Category
2;es un anuncio interesante que le puede servir para alguien;321
3;es un anuncio de un banco que quiere presentarse como una compañía;NONE
4;es un anuncio de un banco que ofrece prestamos para empresas.;70
5;credito pyme bana para hacer crecer tu negocio;50
5;credito pyme bana para hacer crecer tu negocio;52
5;credito pyme bana para hacer crecer tu negocio;70
5;credito pyme bana para hacer crecer tu negocio;71
6;comercial que te hace pensar en considerar a bana para poner tu negocio;50
6;comercial que te hace pensar en considerar a bana para poner tu negocio;71
7;este anuncio da una breve explicación sobre el tratamiento de hemodialisis;50
8;un anucio de bana donde muestra que se puede pedir un crédito para emprender;50
8;un anucio de bana donde muestra que se puede pedir un crédito para emprender;52
8;un anucio de bana donde muestra que se puede pedir un crédito para emprender;70
8;un anucio de bana donde muestra que se puede pedir un crédito para emprender;71
9;bonito;NONE
File 2:
ID;Coments;Category
2;es un anuncio interesante que le puede servir para alguien;321
3;es un anuncio de un banco que quiere presentarse como una compañía;57
4;es un anuncio de un banco que ofrece prestamos para empresas.;50
5;credito pyme bana para hacer crecer tu negocio;52
6;comercial que te hace pensar en considerar a bana para poner tu negocio;50
7;este anuncio da una breve explicación sobre el tratamiento de hemodialisis;210
8;un anucio de bana donde muestra que se puede pedir un crédito para emprender;50
9;bonito;303
Desired Output:
For the ID-2, we have achieved a 100% success rate.
For the ID-3, we have achieved a category.
For the ID-4, we have achieved a 100% success rate.
For the ID-5, we achieved a 25% success rate.
For the ID-5, we achieved a 50% success rate.
For the ID-7, we have achieved a 100% success rate.
For the ID-8, we have achieved a 25% success rate.
For the ID-9, we have achieved a category.
One approach could be this small. But of course, I need to calculate percentages and print it on like my desired output format.
awk 'BEGIN { FS=OFS=";" } NR==FNR{cnt[$1]++; next} { cnt2[$1]++;} END{ for (ID in cnt){ print ID, "CAT: "cnt[ID],"Manual: "cnt2[ID];}}'
Awk is for this
awk -F ';' '
FNR==1{next}
FNR==NR{C1[$1]++;N1[$1]=($3!~/NONE/);next}
{C2[$1]++;if($3!~/NONE/)N2[$1]++}
END{
for(c in C1){
if((N1[c]==0)&&(C2[c]>0)&&(N2[c]>0)){
S="we have achieved a category."
}
else S=sprintf( "we have achieved a %d%% success rate.", C2[c]*100/C1[c])
printf "For the ID-%d, %s\n", c, S
}
}' file1 file2

convert certain special characters to ascii in php

I need a php script that convert certain special characters to ascii code( , . / - and all the letter with accent)
eg.
original:
Dingo a accidentellement fait tomber la pièce porte-bonheur de Mickey tout au fond du lac. Le Professeur Von Drake va utiliser son camping-car et le transformer en sous-marin pour explorer les eaux profondes.
result:
Dingo a accidentellement fait tomber la pièce porte-bonheur de Mickey tout au fond du lac. Le Professeur Von Drake va utiliser son camping-car et le transformer en sous-marin pour explorer les eaux profondes.
I've tried htmlspecialchars() doesn't seems work out it only convert the characters which are special significance in HTML
If you look at the documentation of htmlspecialchars() you will see:
If you require all input substrings that have associated named entities to be translated, use htmlentities() instead.

Resources