user68650
user68650

Reputation: 115

Em-Editor Custom TSV

I usually deal with large standardize delimiters similar to a “xxxx”,”xxxxx” (comma separated with quotes). Instead of those characters we use the following

Text Character ASCII Character

———————————————

Comma ————-> 20

Quote ————-> 254

NewLine ————-> 174

Multi Value ————-> 059

Nested Value ————-> 082

Currently i use a macro with RegEx to converted to Tab Format by replacing \x{00FE}\x{14}\x{00FE} with \t Is there a method of creating a TSV definition in EE? so i can quickly switch from format to format?

I have attempted without success, changing the delimeter in the Tools → Customise → CSV section, but there is method of replacing quote character

I tried replacing the delimiter in two was \x{14} and \x{00FE}\x{14}\x{00FE}

http://nextcloud.eclipsephoto.net/nextcloud/index.php/s/5b8pen55LW43cPr

I have already tried but did not seem to work,

thank you in advance.

Upvotes: 1

Views: 383

Answers (1)

Yutaka
Yutaka

Reputation: 1806

Please enter \xfe\x14\xfe in the Delimiter text box in the CSV page of the Customize dialog box.

Alternatively, you can replace \xfe with a double quote, and \x14 with a tab after you open your file. I wrote a macro for you:

batch_list = editor.filters;
batch_list.AddReplace("\\xfe","\\x22",eeFindReplaceCase | eeFindReplaceEscSeq,0);  // replace \xfe with a double quote
batch_list.AddReplace("\\x14","\\t",eeFindReplaceCase | eeFindReplaceEscSeq,0);  // replace \x14 with a tab
document.selection.BatchReplace(batch_list,eeReplaceAll,0);  // batch replace
editor.ExecuteCommandByID(22529); // TSV mode
editor.ExecuteCommandByID(3894);  // heading 1

You can run this macro after you open your data file. To do this, save this code as, for instance, OpenDataFile.jsee, and then select this file from Select... in the Macros menu. Finally, open your data file, and select Run in the Macros menu while your data file is active.

Updates

EmEditor v20.0.901 now allows any arbitrary character to be used as a quotation mark for a CSV format. Please update EmEditor to v20.0.901 (or above), select Customize on the Tools menu, select the CSV page, and click the Reset button to add the Concordance load file (DAT) format to the CSV format list, or you can manually add a new format to your existing list with the delimiter of \x14 and the quotation mark of \xfe.

After you open a DAT file, you can click the "DAT" button in the CSV/Sort toolbar. To select the DAT format automatically when a file is opened, select Properties for Current Configuration on the Tools menu, select the File page, and set the Concordance Load File (DAT) (or your new CSV Format) check box in the CSV files to Detect list box.

If you want to remove quotation marks (or thorns) after you open a DAT file, you can click the CSV Converter button in the CSV/Sort toolbar, and click Remove Unnecessary Quotes button.

Upvotes: 1

Related Questions