delete lines

Questions about XML that are not covered by the other forums should go here.
peteeey90
Posts: 4
Joined: Tue Apr 12, 2016 3:51 pm

delete lines

Post by peteeey90 »

Hello!
I have a huge about 700000 lines xml file.
I would like to delete whole lines where I find this code: label="9"

Code: Select all

	<note player="@ndre�_0989" label="13" update="1460278894"></note>
<note player="\�_�7" label="9" update="1455205849"></note>
<note player="A.RiverR@t�" label="9" update="1455205849"></note>
<note player="absolutim�o" label="9" update="1460278894"></note>
<note player="Aces�Ashes69" label="8" update="1460278894"></note>
<note player="acib�983" label="9" update="1455205849"></note>
<note player="acib�983" label="9" update="1455205849"></note>
What is the easiest way to do this?
I use oxygen 12.0
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: delete lines

Post by adrian »

Hi,

You can do this in the Find/Replace dialog (menu > Find > Find/Replace). Note that this will blindly delete entire lines. Use with caution.
Enable Regular expression
Find:

Code: Select all

^.*?label="9".*?$\n
Replace with: leave empty
Press Replace All

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
peteeey90
Posts: 4
Joined: Tue Apr 12, 2016 3:51 pm

Re: delete lines

Post by peteeey90 »

Hi Adrian,

thanks your help, but I always get "String not found" message.
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: delete lines

Post by adrian »

Did you check the "Regular expression" option?
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
peteeey90
Posts: 4
Joined: Tue Apr 12, 2016 3:51 pm

Re: delete lines

Post by peteeey90 »

Sorry, I missed it. Now works fine! Can you please tell me where a can learn more about Reular expressions?
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: delete lines

Post by adrian »

Hello,

Details about the regular expression syntax used in the Find/Replace dialogs from Oxygen can be found here:
Oxygen XML Editor - Regular Expressions Syntax

There is a very useful interactive tutorial on regular expressions here:
http://regexone.com/
One aspect to note is that there are many flavors of regular expressions. Oxygen uses the Java (Perl5-based) kind.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
peteeey90
Posts: 4
Joined: Tue Apr 12, 2016 3:51 pm

Re: delete lines

Post by peteeey90 »

Hi!
Thanks your links I will check it.
Now I work with a similar xml file.

Code: Select all

update="1460623854"></note><note player="13ďż˝Sa1nt" label="13" update="1455205849"></note><note player="13�Sa1nt" label="13" update="1455205849"></note><note player="1m@g!N�" label="13" update="1460623854"></note><note player="2Fool4Your�" label="9" update="1460623854"></note><note player="4KiNgHďż˝lL" label="9" update="1455961705"></note><note player="666Li�ák" label="9" update="1460623854"></note><note player="6�saro�6" label="13" update="1460623854"></note><note player="7b�SiiieCH" label="13" update="1460623854"></note><note player="@fury@��42" label="13" update="146062385
I would like to add a new line every time after these characters:

Code: Select all

"></note>
I tried /n but this didn't work.
Can you please tell me the code what can do this?

I would like my xml looks like this:

Code: Select all

update="1460623854"></note>
<note player="13�Sa1nt" label="13" update="1455205849"></note>
<note player="13�Sa1nt" label="13" update="1455205849"></note>
<note player="1m@g!N�" label="13" update="1460623854"></note>
<note player="2Fool4Your�" label="9" update="1460623854"></note>
<note player="4KiNgH�lL" label="9" update="1455961705"></note>
<note player="666Li�ák" label="9" update="1460623854"></note>
<note player="6�saro�6" label="13" update="1460623854"></note>
<note player="7b�SiiieCH" label="13" update="1460623854"></note>
<note player="@fury@��42" label="13" update="146062385
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: delete lines

Post by adrian »

Hi,

If you want to insert a line break between start and end tags, it's best to search for the actual tags </note><note and place the line break between
Find: (</note>)(<note)
Replace with: $1\n$2
Each pair of parenthesis determines a capturing group that is referred with $n (n = 1..9)

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply