Results 1 to 8 of 8

Thread: Parsing Experts!!! Need help.

Threaded View

  1. #1

    Thread Starter
    Frenzied Member zynder's Avatar
    Join Date
    Nov 2006
    Location
    localhost
    Posts
    1,434

    Parsing Experts!!! Need help.

    Hello guys! Im having trouble parsing this file although it's a bit easy i can't get it neat and fast. Any suggestion is well appreciated.

    Here is my sample text file.

    Name <1:WALKER, JOHNNY>
    File Number <2:123456>
    Record Number <3:111111>
    Filename: WALKER, JOHNNY_123456_111111 script.txt
    <End>

    CASE: 0001
    NAME: JOHNNY WALKER
    RECORD NUMBER: 111111
    Description is here. The quick brown fox jumps over the lazy dog. Blah blah blah.

    CASE: 0002
    NAME: JACKIE CHAN
    RECORD NUMBER: 222222
    Pneumonoultramicroscopicsilicovolcanoconiosis.

    CASE: 0003
    NAME: JET LI
    RECORD NUMBER: 333333
    Lol lol lol lol lol lol lol.

    CASE: 0004
    NAME: WONG FEI HONG
    RECORD NUMBER: 444444
    Any random description here.
    I need to separate this file into 4 textfiles however the header must be changed according to the name, record number and description. Don't bother the case number and the Filenumber is the same for all of them.

    Case 001 have already the correct header. So it will be saved as "WALKER, JOHNNY_123456_111111 script.txt"

    Name <1:WALKER, JOHNNY>
    File Number <2:123456>
    Record Number <3:111111>
    Filename: WALKER, JOHNNY_123456_111111 script.txt
    <End>

    CASE: 0001
    NAME: JOHNNY WALKER
    RECORD NUMBER: 111111
    Description is here. The quick brown fox jumps over the lazy dog. Blah blah blah.
    Case 002 shoud be saved as "CHAN, JACKIE_123456_222222 script.txt" and the header should be replaced accordingly.

    Name <1:CHAN, JACKIE>
    File Number <2:123456>
    Record Number <3:222222>
    Filename: CHAN, JACKIE_123456_222222 script.txt
    <End>

    CASE: 0002
    NAME: JACKIE CHAN
    RECORD NUMBER: 222222
    Pneumonoultramicroscopicsilicovolcanoconiosis.
    and so on and so forth. the cases could reached up to 30 cases that's why im looking for an elegant way of doing this or even faster.

    So there's one file and the output would be 4 files in that case.

    Thank you and God bless!
    Attached Files Attached Files
    Last edited by zynder; Apr 11th, 2007 at 05:07 AM. Reason: Attached sample file.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width