I have a file person.txt in which there are below lines:
<person>
<id>158</ id>
<name>foo</name>
<city>Paris</city>
</person>
<person>
<id>19,521 </id>
<name>Mama</name>
<city>Mumbai</city>
</person>
<person>
<id> 75,142 </id>
<name>Kaka</name>
<city>Kolkata</city>
</person>
the <id>xxxxx</id> can be any number but there is "<id>xxxxx</id>" = N times. I would split the file into N files: File "person158" which is:
<id>158</id>
<name>foo</name>
<city>Paris</city>
File "person19521" which is
<id>19,521 </id>
<name>Mama</name>
<city>Mumbai</city>
and so on ...
I would like to create .txt (person158.txt, person19521.txt ...) in which
are the corresponding information. In "person158.txt" there will
<id>158</id>
<name>foo</name>
<city>Paris</city>
in "person19521.txt" there will
<id>19,521 </id>
<name>Mama</name>
<city>Mumbai</city>
and so on.
Therefore in the initial file search for <id>xxxxx</id> with these names create "personxxxxx.txt" and "personxxxxx.txt" to copy the lines located in the main file.
I am beginner in shell
Bookmarks