I
I
Ivan2020-09-11 12:19:25
bash
Ivan, 2020-09-11 12:19:25

Find data in bash files?

Good afternoon in bash is almost zero +, I have many different subdirectories with different names, but each of them has 123.xml with data of the same type.
How can I find the parameters of the uid data name type I need from all the 123.xml that are in the directories and write them all in turn to the file?
Tell me please?

UPD. Thanks for answers. The farther into the forest, the angrier the partisans. Much cleared up but not quite.
As a result, I came to the conclusion that I need to pull this out of all these *document.xml and in that order

grep -h -r xdms:number */*document.xml&grep -h -r xdms:date */*document.xml&grep -h -r xdms:header */*document.xml
 <xdms:header xdms:type="��������" xdms:uid="197C0D87-15CD-4019-B7B0-ED101EDC75A1" xdms:created="2020-07-14T12:18:04.023">
  </xdms:header> 
      <xdms:date>2020-07-10</xdms:date>
      <xdms:number>А26-6666</xdms:number>
          <xdms:date>2020-07-10</xdms:date>
          <xdms:number>А26-20-НО-77039231-СО1</xdms:number>
  <xdms:header xdms:type="��������" xdms:uid="066677AA-EB8B-45FB-A4CD-99B2D2239F33" xdms:created="2020-07-14T12:18:04.353">
  </xdms:header> 
  <xdms:header xdms:type="��������" xdms:uid="51429AE7-3A66-4713-804B-82FB8D760731" xdms:created="2020-07-14T12:18:04.417">
  </xdms:header> 
      <xdms:number>А26-2222</xdms:number>
      <xdms:date>2020-07-10</xdms:date>
          <xdms:date>2020-07-10</xdms:date>
          <xdms:number>А26-20-НО-77039231-СО1</xdms:number>
  <xdms:header xdms:type="��������" xdms:uid="EA50943C-AA47-4978-A5C9-A6A6583EF65C" xdms:created="2020-07-14T12:18:04.563">
  </xdms:header> 
  <xdms:header xdms:type="��������" xdms:uid="22331428-64B9-40E7-A6E0-A4A488280C9D" xdms:created="2020-07-14T14:41:31.613">
  </xdms:header> 
      <xdms:date>2020-07-10</xdms:date>
          <xdms:date>2020-07-10</xdms:date>
      <xdms:number>А26-7777</xdms:number>
          <xdms:number>А26-20-НО-77039231-СО1</xdms:number>

As a result, I get a sheet of data from those 29 of my *document.xml files that the developer's software generates.
How can I make it clear the number date uid by columns, otherwise it's some kind of confusion.
After all, grep searches the directories one by one and gives out the information of the blocks from each subdirectory in some alphabetical order, or is it sorted by date?
If by date and time, then why 2020-07-14T12:18:04.353 there are no number and date values, but in 2020-07-14T12:18:04.417
they seem to be.
Those. how to track all number date uid dependencies?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2020-09-11
@saboteur_kiev

grep -oP 'xdms:document.*uid="\K[0-9A-F-]*' */*document.xml | tr '\n' ';'

S
SOTVM, 2020-09-11
@sotvm

grep "text_regular" file_in which we are looking for
grep "blah blah blah">> exhaust
and it's better to "smoke once"
man finde and man grep )))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question