Tapatalk

Spliting files + saving BUT.. Line starts with same word.

Spliting files + saving BUT.. Line starts with same word.

3

    Jan 09, 2006#1

    I have no idea how to write "unique files or put an explict example" as told to me by a great helpful user whom I thank much.
    I want to Export text to save as new files 150 lines at a time from a 40 thousand+ line Document. Problem is they all start with one of two words..
    "TAG" or "GOTO"

    I will use 3 lines not 150 as example..

    I would like edit to go something like this on a 3 line example out of 18 lines exported to seperate pages, tabs or txt FILES if possible.

    file to split.. and each split would be a new txt file in a folder or on the desktop without overwriting itself.


    GOTO=http://............1
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........
    GOTO=http://............2
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........
    GOTO=http://............3
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........
    GOTO=http://............4
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........
    GOTO=http://............5
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........
    GOTO=http://............6
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........


    split = saved text file or new document from highlighted text exort

    split 1

    GOTO=http://............1
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........

    split 2

    GOTO=http://............2
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........

    split 3

    GOTO=http://............3
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........

    split 4

    GOTO=http://............4
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........

    split 5

    GOTO=http://............5
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........

    split 6

    GOTO=http://............6
    TAG POS=1 TYPE=IMG ........
    TAG POS=1 TYPE=INPUT:SUBMIT.........

    I am a newbie here and have been reading the forums trying not to bother people about this for hours. I thought I should now ask. This is a macro problem and thought I should ask here...

    below is the 2 macros code that overwrote the file in a 3 line example.

    Code: Select all

    Loop 3
    StartSelect
    Key DOWN ARROW
    IfEof
    ExitLoop
    EndIf
    EndLoop
    Copy 
    EndSelect

    Code: Select all

    InsertMode
    ColumnModeOff
    HexOff
    Top
    Loop 
    PlayMacro 1 "1"
    Cut 
    NewFile
    Paste 
    Key UP ARROW
    SelectWord 
    SaveAs "F:\split test\^s.txt"
    Key DOWN ARROW
    CloseFile NoSave
    IfEof
    ExitMacro
    EndIf
    EndLoop
    Clipboard 0
    

    344
    MasterMaster
    344

      Re: Spliting files + saving BUT.. Line starts with same word

      Jan 09, 2006#2

      Hi guy,

      Well, if I understood it right its easy too :idea:
      I take the last number of each first-line of a block as unique filename, here: 1,2 and 3. --> 1.txt 2.txt 3.txt

      Take these 2 Makros as example:

      splitFile

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      Top
      Loop 
      PlayMacro 1 "splitFile2"
      Cut 
      NewFile
      Paste 
      Top
      Key END
      StartSelect
      Key Ctrl+LEFT ARROW
      Copy 
      SaveAs "c:\^c.txt"
      CloseFile NoSave
      IfEof
      ExitMacro
      EndIf
      EndLoop
      Clipboard 0
      
      splitFile2

      Code: Select all

      Loop 3
      StartSelect
      Key DOWN ARROW
      IfEof
      ExitLoop
      EndIf
      EndLoop
      Copy 
      EndSelect
      
      Runs good with your example. 3 files are created.


      Give it a try. (replace 3 in macro2 with 150, if you ALWAYS have a 150 line range ...)

      rds bego[img]c:\temp\temp.jpg[/img]
      Normally using all newest english version incl. each hotfix. Win 10 64 bit

      3

        Re: Spliting files + saving BUT.. Line starts with same word

        Jan 10, 2006#3

        Thank you .. again! I am still having problems getting it to recognize and keep the extra 2 lines that start with "TAG" It is finding the line that starts with "GOTO" and extracting only that and saving 1 line insted of 3 line text files.

        My current files will contain "GOTO=http://............6" and are called "6"
        I would like the "6" file to contain...

        >>>>>>>>>>>>>>>>>>>>>>>
        GOTO=http://............6
        TAG POS=1 TYPE=IMG ........
        TAG POS=1 TYPE=INPUT:SUBMIT.........
        <<<<<<<<<<<<<<<<<<<<<<<

        Should I start a new macro for batching the finished 1 line files?
        .....
        Can I batch open them and add the new text "TAG..." I think I can using the method you had shown me a couple posts back except the batch command if any is not in my head yet. I will do a search.


        Newbie brain power! or was is just dust in the wind? I lose so far.