Splitting an extraction

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
shaves
Posts: 77
Joined: Tue Apr 29, 2008 6:50 pm

Splitting an extraction

Post by shaves » Wed Nov 12, 2008 11:03 pm

I have extracted the contents of a table; which is a tree. The tree consists of cost centers, areas, cities, and locations. When this tree is extracted, it is one long string. The separator appears to be a small square.

Normally, I split data on either "#NEXT#" or "#NEWLINE#". I tried to split this data on " " (space) but then I get a separate line for each word in a cost center, area, city, or location. Instead I need to have each one of these categories as a separate line.

For example, I need:

Midwest
Kansas City Area
Kansas City
Branch 55

instead of
Midwest
Kansas
City
Area
Kansas
City
Branch
55

I'm stumped as to how to code this split. Any suggestions would be greatly appreciated. Thanks for the help....
User avatar
Tech Support
Posts: 4947
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Re: Splitting an extraction

Post by Tech Support » Tue Nov 18, 2008 12:08 pm

If you extract the data as HTML (EXTRACT=HTM) what code do you get then? Maybe this contains something like a <br> that can be used for correct splitting.
imacuser
Posts: 8
Joined: Sun Jan 27, 2008 1:14 am

Re: Splitting an extraction

Post by imacuser » Wed Jan 07, 2009 6:17 am

shaves wrote:I have extracted the contents of a table; which is a tree. The tree consists of cost centers, areas, cities, and locations. When this tree is extracted, it is one long string. The separator appears to be a small square.

Normally, I split data on either "#NEXT#" or "#NEWLINE#". I tried to split this data on " " (space) but then I get a separate line for each word in a cost center, area, city, or location. Instead I need to have each one of these categories as a separate line.

For example, I need:

Midwest
Kansas City Area
Kansas City
Branch 55

instead of
Midwest
Kansas
City
Area
Kansas
City
Branch
55

I'm stumped as to how to code this split. Any suggestions would be greatly appreciated. Thanks for the help....
If you can post sample data, I might help you.
slamsal
Posts: 96
Joined: Fri Sep 12, 2008 4:39 pm

Re: Splitting an extraction

Post by slamsal » Wed Jan 14, 2009 3:06 pm

I would suggest this.

1) Split up (You need to know 'Split' function in VB. ) http://spreadsheetpage.com/index.php/ti ... _function/ might be a goodlink to look at.

Midwest
Kansas
City
Area
Kansas
City
Branch
55

2) and write a code to combine
a(0) => Midwest
combine a(1), a(2) and a(3) => Kansas City Area
combine a(4) and a(5) => Kansas City
combine a(6) and a(7) => Branch 55
Sanjiv Lamsal
iMacros Consultant
Duluth, MN USA
sanjivlamsal@hotmail.com
imacuser
Posts: 8
Joined: Sun Jan 27, 2008 1:14 am

Re: Splitting an extraction

Post by imacuser » Wed Jan 14, 2009 5:17 pm

I do such things in notepad
press tab key, copy that text, use it to replace seperator
paste the text into excel
data will go in columns

now concatenate appropriate columns

you can also seperate data in excel itself
Data - Text To Columns
specify seperator
Post Reply