Search only a value via shell script

Asked

Viewed 47 times

0

Galley,

I am creating a script to fetch a value, however, within the BDD there are repeated values and I would like to search only one of each. For example, there are several units for each state, but I want to search only for the main unit. There are 28 main units and 720 secondary units. The 720 secondary units have as "Pai unit" one of the 28 main units.

For example², the state of Sao Paulo has 150 units, however, only one is the main one and consequently becomes the "parent unit" of the other 149 units.

Anyway, every time I perform a unit search it returns to me all, however, I just want to return the main units. Their ID ranges from 1 to 28.

The search is performed via Rest, through the shell script.

  • Could you put some code to better illustrate your question.

  • What is the format of the Rest answer? Json bonitificado? XML in a single line? CSV? Plain text? How to know which is the main one? How I identify the id of each object?

  • Normally Rest returns a kind of deep data (ie, objects within objects), not necessarily shallow. If you don’t have a shallow object, you can only interpret correctly using an identifier for context-free languages, which are more powerful than regular expressions. For deep object cases, another language is more suitable, such as M4, Java, Python etc

  • Hello, I ended up solving this by searching each parent unit id, for example: Rest/gestao/Unit? id=1&id=2&id=3... etc. Not the best solution, but it solved my problem. I appreciate your answers!

  • Hello Leticia, nice that solved your question. You would mind posting your answer so that it is useful for those who have the same question?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.