EmEditor (text editor) Forum Index
   Questions and Answers about EmEditor Core
     cross tabulation
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
user
Posted on: 9/23/2011 8:14 am
Home away from home
Joined: 9/29/2006
From:
Posts: 212
cross tabulation
hello

I have in an excel file a table like this and I want to make it look like the table below:



anyone know how to do it?

thanks!
CrashNBurn
Posted on: 9/23/2011 8:45 am
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: cross tabulation
Save the excel document as a CSV.

Open file in EmEditor.

Edit -> Separated Values/Sort -> CSV Mode
user
Posted on: 9/23/2011 9:03 am
Home away from home
Joined: 9/29/2006
From:
Posts: 212
Re: cross tabulation
thanks, but I don't think you understood my question

I know how to create csv files and open then in EmEditor

what I want is to transform the first table into the second (as shown in the picture)
CrashNBurn
Posted on: 9/23/2011 10:18 am
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: cross tabulation
AH! Sorry

Well given the following input:
Quote:
34,George,Clooney,123456,LDL,356,mg
34,George,Clooney,123456,HDL,324,ml
34,George,Clooney,123456,VLDL,635,kg


If your file is tab delimited instead of commas, then you will need to replace all commas below with "\t"

Step 1:
Search: ^(\d+),([A-Za-z]+),([A-Za-z]+),(\d+),(.*)
Replace: \1,\2,\3,\4,\n\5

Step 2:
Search: ^(\d+,[A-Za-z]+,[A-Za-z]+,\d+,)\n[A-Z]+,(\d+),([a-z]+)\n\1\n[A-Z]+,(\d+),([a-z]+)\n\1\n[A-Z]+,(\d+),([a-z]+)\n
Replace: \1\2 \3,\4 \5,\6 \7\n


Final Output:
34,George,Clooney,123456,356 mg,324 ml,635 kg



user
Posted on: 9/23/2011 12:14 pm
Home away from home
Joined: 9/29/2006
From:
Posts: 212
Re: cross tabulation
thanks for your reply

it would be interesting if it works, but I got the message "Cannot find ^(\d+),([A-Za-z]+),([A-Za-z]+),(\d+),(.*) anywhere in the document"

(regex are enabled)

also, please note that the original text is:

34,George,Clooney,3456346,LDL,356,mg
34,George,Clooney,3456346,HDL,324,ml
34,George,Clooney,3456346,VLDL,635,kg
34,Tom,Cruise,4573456,LDL,463,dl
34,Tom,Cruise,4573456,HDL,746,cm
34,Tom,Cruise,4573456,VLDL,435,dc
35,Al,Pacino,5646464,LDL,467,hg
35,Al,Pacino,5646464,HDL,352,df
35,Al,Pacino,5646464,VLDL,643,rf

and not just:
34,George,Clooney,3456346,LDL,356,mg
34,George,Clooney,3456346,HDL,324,ml
34,George,Clooney,3456346,VLDL,635,kg

any hint?
CrashNBurn
Posted on: 9/23/2011 12:25 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: cross tabulation
At the right of the Search field is [>]
Click on that and choose "Multiline"
user
Posted on: 9/23/2011 1:09 pm
Home away from home
Joined: 9/29/2006
From:
Posts: 212
Re: cross tabulation
there is no multiline displayed in your posted search and replace values (probably due to the forum format)

can you paste them as plain text?
CrashNBurn
Posted on: 9/23/2011 2:07 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: cross tabulation
Multiline is a regex option. You need to select it.
My Search regex is a multiline regex (it contains multiple newlines). You need to select "Multiline" from the pop-up menu that is available when you click [>]
user
Posted on: 9/24/2011 2:15 am
Home away from home
Joined: 9/29/2006
From:
Posts: 212
Re: cross tabulation
> My Search regex is a multiline regex (it contains multiple newlines).

I know, but when I copy it and paste it in any text editor (not just in the search field of EmEditor), it shows as a single line

also, have you noted that the original text is:
34,George,Clooney,3456346,LDL,356,mg
34,George,Clooney,3456346,HDL,324,ml
34,George,Clooney,3456346,VLDL,635,kg
34,Tom,Cruise,4573456,LDL,463,dl
34,Tom,Cruise,4573456,HDL,746,cm
34,Tom,Cruise,4573456,VLDL,435,dc
35,Al,Pacino,5646464,LDL,467,hg
35,Al,Pacino,5646464,HDL,352,df
35,Al,Pacino,5646464,VLDL,643,rf

and not just:
34,George,Clooney,3456346,LDL,356,mg
34,George,Clooney,3456346,HDL,324,ml
34,George,Clooney,3456346,VLDL,635,kg

isn't there any problem with that?
CrashNBurn
Posted on: 9/24/2011 8:19 am
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: cross tabulation
EmEditor Home » EmEditor Help » Dialog Boxes

> button

Quote:
...
Multiline

Toggles between singleline and multiline of the drop-down list box (this command appears only in the Find dialog box and Replace dialog box).


In a Regex string, a \n is a newline.
As well as \r\n e.g. CRLF

The fact that my regex is a "single line string" is irrelevant. It contains multiple \n newlines, and if you want it to work as intended ---- which is to look on multiple lines for search matches/input, then you need to select "Multiline" from the dialog, as I mentioned previously.
Threaded | Newest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文