Should I use capture text filter ?

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

Matrix1990
Posts: 3
Joined: Fri Nov 09, 2012 3:40 pm

Should I use capture text filter ?

Postby Matrix1990 » Fri Nov 09, 2012 4:29 pm

Hi everyone,

I tried to look into the forum but can't figure out how to do it.

>>>>>>>>>>
I have a text file with URL's like below:

https://spideroak.com/share/Party/Black ... 8DJ%29.mp3
https://spideroak.com/share/Party/Bomba ... 8DJ%29.mp3
https://spideroak.com/share/Party/Fatbo ... 8DJ%29.mp3
https://spideroak.com/share/Party/Flo%2 ... 8DJ%29.mp3
https://spideroak.com/share/Party/Imeld ... 8DJ%29.mp3
https://spideroak.com/share/Party/T-Pai ... 8DJ%29.mp3


I want to pick this lines one by one and create new text file with following pattern:

<track>
<location>URL</location>
<creator></creator>
<title>WRITE SONG TITLE HERE</title>
<annotation></annotation>
</track>

For Example:
<track>
<location>https://spideroak.com/share/Party/Flo%20Rida____Low%28DJ%29.mp3</location>
<creator></creator>
<title>Flo Rida - Low(DJ).mp3</title>
<annotation></annotation>
</track>
<track>
<location>https://spideroak.com/share/Party/T-Pain____Church%28DJ%29.mp3</location>
<creator></creator>
<title>T-Pain - Church(DJ).mp3</title>
<annotation></annotation>
</track>

I am familiar with Extract Line Matching, Perl Pattern, Merge to file, Restrict to attribute and couple of others simple filters.
I can't figure out how to deal with this thing.

Just help me out with the filters to be used and their sequence and I will try to solve this thing.

Their are around 420 URLs in the file. If I can automate this thing It would save me lot of time & energy.
Please help me out.

Thanks in advance.....

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Should I use capture text filter ?

Postby DataMystic Support » Mon Nov 12, 2012 8:39 am

Easy, use a perl regex search/replace, search for:

Code: Select all

^https://spideroak.com/share/Party/([^/]*)\.mp3$


Replace with:

Code: Select all

<track>
<location>$0</location>
<creator></creator>
<title>$1</title>
<annotation></annotation>
</track>



If need be, you can also post-process the filename to remove the escaped characters - let me know if you want this too.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

Matrix1990
Posts: 3
Joined: Fri Nov 09, 2012 3:40 pm

Re: Should I use capture text filter ?

Postby Matrix1990 » Wed Nov 14, 2012 7:22 pm

Thanks a lot man. It worked like charm. Thank you.

I thought i gotta use 4-5 filters. Ha Ha. You did it in one filter.

Yes I do want to get rid of the escape characters.

Please help me with that.

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Should I use capture text filter ?

Postby DataMystic Support » Thu Nov 15, 2012 6:20 am

Ok, to remove escaped characters, add a new EasyPattern search replace:

Code: Select all

<title>[ capture(1+ not '<' )]</title>


Instead of entering a replace text, set the Action field to 'Send variable 1 to subfilter'.

Then, add a Filters\Convert\HTTP\HTTP Decode as a SUBFILTER, so it acts on the restricted text.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

Matrix1990
Posts: 3
Joined: Fri Nov 09, 2012 3:40 pm

Re: Should I use capture text filter ?

Postby Matrix1990 » Fri Nov 16, 2012 12:44 am

Thanks a lot it worked. :D


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: No registered users and 2 guests