How can I use the long list of change script format?

Hello world

If I have such a long list

0101
Long white radish
Chinese celery
Tah tsai
Round cucumber
Cherry radish
fennel
Small rocket leaves
Gourd small wax
0102
Green-leaf lettuce
Large rocket leaves
UFO squash
Crystal radish
Vague red lettuce
Green Endive
Pumpkin sponge
Rose heart radish
Butter Lettuce
Radicchio
0103
Chinese mustard
Then
Yellow Zucchini
Turnip
Malabar spinach
Chinese cabbage
Green bean
Edible rape
Begonia fimbristipulata hance
Purple bean
Cabbage
Water spinach
Okra
Snow peas

How can I change the format in this:

0101
White radish 0101/long
0101/Chinese celery
0101/Tah tsai
0101/round of cucumber
0101/cherry radish
0101/fennel
0101/small rocket leaves
0101/small wax gourd
0102
0102/green-leaf lettuce
0102/broad leaves Arugula
Squash 0102/UFO
0102/Crystal radish
Wave 0102/red lettuce
Endive 0102/Green
0102/sponge gourd
Radish Rose-0102/heart
0102/butter lettuce
0102/chicory
0103
0103/Chinese mustard
Spinach New Zealand 0103/New
0103/yellow Zucchini
0103/turnip
0103/Malabar spinach
Cabbage Chinese/0103
Bean green/0103
0103/edible rape
0103/begonia fimbristipulata hance
0103/purple bean
0103/cabbage
0103/water spinach
0103/okra
0103/snow peas

using the script?

Thank you

Teetan

I prefer this method

var sourceFile =  File.openDialog ("Select the source .txt file",   ($.os[0] == "W") ? "*.txt" : function (f)  { return (!f.name.match(/\./)) || (f instanceof Folder) || f.name.match(/\.txt$/i);});

if (sourceFile) {
    sourceFile.open('r');
    var text = sourceFile.read().replace(/\n/g, "\u6754"),
        r1 = /(\d{4})(((.(?!\d{4})){1,4})+)/g,
        r2 = /\u6754/g,
        result, a = [], n = 0
        destFile = new File (File.decode(sourceFile.fullName).replace(/\.txt$/i, " changed " + (new Date).toString ().replace(/:/g, ";") + ".txt" ));
    sourceFile.close();
    while((result = r1.exec(text)) != null) {
        a[n++] = (result[1] + (result[2].replace(r2, "\n" + result[1] + "/")));
    }
    destFile.open ('w');
    destFile.write (a.join("\n"));
    $.sleep(200);
    destFile.close();
    destFile.execute();
    alert("new Document: " + destFile.fsName + " created")
}

Tags: InDesign

Similar Questions

  • How can I remove the long list of notifications I on iPad?

    How can I remove the long list of notifications that I have on my iPad?

    Please treatment this issue Apple.

  • I need to unlock the email address that I've blocked by mistake on the red list. How can I find the blocked list?

    How can I get the blocked list of emails that I blocked to come to my email?

    You need to tell us what e-mail program using.
  • I bought an iphone 4 on ebay but it's locked, icloud so I am not able to use it, and the previous owner is available to remove the device from their account: How can I use the appliance?

    I bought an iphone 4 on ebay but it's locked, icloud so I am not able to use it, and the previous owner is available to remove the device from their account: How can I use the appliance?

    You can not. Try to return the unit and get your money back. There is absolutely no way for you to unlock the device,

  • Game to "Save history" for 30 days, can only view last 7 days - how can I view the longer history of 7 days?

    "Save history" set to 30 days but can only view last 7 days of history - how can I view the longer history of 7 days?

    According to your troubleshooting info, you have 2 set preferences to update the:
    Browser.history_expire_days
    7

    Browser.history_expire_days. Mirror
    7

    In the address bar, type Subject: config and press ENTER. The subject: config "This might void your warranty!" warning page may appear. Click on that I'll be careful, I promise! to continue on the subject: config page.
    Search for the preference browser.history_expire_days. Right-click on it and select reset. Do the same for other preferences.

  • How can I use the speed dial on my Motorola W490?

    How can I use the speed dial on my motorola W490? I have followed the instructions on the manual book, but did not work.

    The result, I received the screen is "unauthorized."

    Pls help. THX.

    Desiree-

    Can you tell us what steps you took to set your speed dial and use it?

    W490 User Guide

    On page 61, you can find information about adding dial numbers to speed up and 62 mentions how you dial. For example if you have saved your Uncle Paul as Dáil speed 3, you simply hold the button 3 to call this contact.

    Mark

    Support Forums Manager

  • How can I use the same graph of façade in several events in a structure of the event?

    I want to display my sensorDAQ signals in a graph.but I have more than one event in the case where the structure to acquire the signal and display it in the first round of graph.the is to acquire signals from threshold and its shown in the graphic as a feedback.after the first event is executed, I'll call the second event, where the other signals are acuired and compared with signals from threshold of event 1 my question is how can I use the same control on front panel in more than two events in the structure of the event? Please answer me I am stuck.

    Hello

    I have attached here an example of doing the same thing using local variables and shift registers. Take a peek inside. Shift register is always a better option than local variables.

    Kind regards

    Amine31

    (Bravo to give good answers, mark it as a solution if your problem is resolved)

  • How can I use the copy of Windows XP from the desktop on the laptop?

    loading xp with a different product code

    I have a laptop that works under XP. I lost track of the original disc. I also have an office which was under XP but Win 7 is working now. I have the XP installation disc. How can I use the drive of the desktop on the laptop?

    I dought you would get away with it. Try kb892130

    Or the pc on a xp boot cd, reinstall xp with xp cd.

  • How can I print the individual lists in a group of Windows Mail?

    Original title: Group of Windows Mail in Vista

    How can I print the individual lists in a group of Windows Mail?

    There is no printing functionality in Windows Vista Mail group.

    However, if you highlight all the individuals that you want to print, then click Print in the toolbar, it will print out them pretty much the same way that you would expect from a group.

    Click here to enlarge this photo.

  • When I try to send and receive e-mail using Windows Mail, it wants to use a made up connection. How can I use the wireless connection?

    Windpws Mail & Wi - Fi

    I just installed a TalkTalk wireless router which seems to have installed correctly. However when I try to send and receive e-mail using Windows Mail, she wants to use a made up connection. How can I use the wireless connection? Thank you very much, Dianthus MJ.

    Go to tools | Accounts | Mail | Properties | Connection and check or change the connection properties.  You will need to remove the account and then add it again, but try first and also check tools | Options | Connections.

    Steve

  • How can I use the Media Center to watch video content on my smart TV

    Separated from this thread.

    How can I use the Media Center to watch live video content on my smart TV with Wifi. I couldn't find the instructions to do with Media Player, which I did not

    Separated from this thread.

    How can I use the Media Center to watch live video content on my smart TV with Wifi. I couldn't find the instructions to do with Media Player, which I did not

    do you mean WiFi Direct or WiDi (wireless display)? If WiDi, you need Intel WiDi software installed on a compatible computer.

    What brand of TV and the exact model? If you have Windows Media Center on your computer, you should have Windows Media Player. You can have it disabled in programs, but you can reactivate.

  • How can I use the signature keys in my bweb application works

    Hi all

    How can I use the signature keys in my web work BlackBerry application, I'm looking for video, guide, documentation, step-by-step flow link

    Finally how to properly test it on a Simulator before giving the cod to the words App validation team

    Thanks for your time

    Hello

    Have you seen the guides posted here?

    https://bdsc.webapps.BlackBerry.com/HTML5/documentation/ww_publishing/signing_your_app_1920008_11.ht...

    What stage are you having problems with?

    Erik Oros

    BlackBerry Development Advisor

  • How can I use the "fnd_user_pkg.updateuser" package to disable users in bulk?

    Hello

    How can I use the "fnd_user_pkg.updateuser" package to disable users in bulk?

    in EBS R12.1.3, oracle 11g.

    Please see the request for information of the user

    -------------------------------------------------------------------------------------

    SELECT

    SEPARATE

    FU. USER_NAME

    FULL_NAME EMPLOYEE_NAME

    , TO_DATE (LAST_LOGON_DATE, "dd/mm/rrrr") LAST_LOGON_DATE, end_date, FU.start_date

    OF FND_USER FU, PER_ALL_PEOPLE_F PERX

    WHERE 1 = 1

    AND PERX. PERSON_ID = FU. EMPLOYEE_ID

    AND SYSDATE BETWEEN PERX. EFFECTIVE_START_DATE AND PERX. EFFECTIVE_END_DATE

    AND PERSON_TYPE_ID! = 1118 - excluded candidates iRec

    AND LAST_LOGON_DATE < = TO_DATE (December 31, 2012 ', "dd/mm/rrrr") and end_date is null

    ORDER BY TO_DATE (LAST_LOGON_DATE, "dd/mm/rrrr") / / desc

    ------------------------------------------------------------------------------------

    Concerning

    Ngoyi

    Hello

    You need to do the opposite of what the code in the discussion below is:

    fnd_user_pkg. UpdateUser - End Date remove users

    Kind regards

    Bashar

  • How can I use the DC Acrobat Customization Wizard to include an Adobe ID sign in?

    How can I use the DC Acrobat Customization Wizard to include an Adobe ID sign in?  I want my users to install through our deployment tools without having to enter an email address and password after launching the software for the first time.  Thank you.

    This feature has always existed. In the Customization Wizard screen, fill in all fields and don't forget to click on "Grant offline Exception." This avoids having users connect to activate the product because the product is activated by the administrator on behalf of all users.

    HTH,

    Ben

  • How can I use the CC of color under Windows?

    How can I use the CC of color under Windows?

    Or is it an online color Analyzer?

    Hello

    You can use CC to color online at the Adobe color CC. It is a great web app.

    Sue.

Maybe you are looking for

  • Install Firefox sync does not not on fresh Ubuntu

    Fresh installation of Ubuntu 64-bit 13.10 with a new installation of Firefox 25. The installation of Firefox Sync program worked flawlessly, except that it does not work. I not encounter errors, and when I said to synchronize the process seems to com

  • DRIVERS FOR WINDOWS 7 32 BITS FOR HP 240 G3 MODEL

    BOUGHT THE NEW LAPTOP HP 240 G3 K1C59PA BUT IMPOSSIBLE TO FIND A DRIVER FOR WINDOWS 7 32-BIT OPERATING SYSTEM PLEASE HELP ME IS NOT ABLE TO FIND ANY WHERE THANX

  • Ethernet network card does not show my Satellite L830 - 16H

    Hello Ethernet network adapter do not show my Toshiba Satellite L830 - 16H, and it can not reset it What can you do to restore it? I thank everyone

  • HP psc 2410

    The device worked very well without any problem of software for a few years. The problem appeared on the starting upwards when going through its cycles. The transport of the lamp seems to hang up, with the use of the belt as he jumped, although the b

  • Chart from a data file

    I have a data file with these values 1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 I need to plot a graph XY with values of Y that this data and 1,2,3,4,5,6,7,8,9,10,11,12 = X values. What's possible with a chart control, to read the values in the data file and char