Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Handling a Flat Text File

Return to Member Forum

  • Author
    Posts
    • #62392
      hoosier122
      Member

      I am dealing with a flat text file without styles (I'll be adding paragraph styles later). There aren't even tabs. I'll have to figure out a way to insert tabs. Hopefully the number of spaces between “columns” is standardized.

      My first step is a script to remove all the junk. I have some programming/JS experience, but it's mostly limited to online, html and DB management.

      Can someone point me in the right direction of a good, sensical guide for this type of scripting?

      Here is some pseudocode of what I want to do.

      =================

      Delete all characters left of “/2012” (only on that line)

      Replace “London Rippers” with “Rippers”

      Replace “Florence Freedom” with “Freedom”

      etc…

      Replace double linebreaks with single linebreaks

      Delete ” AVG”

      Delete ” .***”

      (I used * to denote wildcard characters)

      Replace ” C ” with ” ct”

      Replace ” P ” with ” pt”

      Replace ” 1b ” with ” 1bt”

      Replace ” 2b ” with ” ct”

      etc… (t is a tab, right?)

    • #62393
      hoosier122
      Member

      Here's a link to one of the files I'll be dealing with.

      https://frontier.bbstats.points…..meid=66468

      I'm actually a bit confused as to where the linebreaks are coming from. When I save it as an .html and open it with an editor, I'm not seeing any <p> or </br> tags for linebreaks. Can anyone see any markup?

    • #62394
      hoosier122
      Member

      Sorry to reply to my own post, but I'm unable to edit my original post.

      The forum's editor stripped out some of my forward and back slashes.

      Specifically in Replace ” C ” with ” ct” There should be a back slash between the 'c' and 't' — so as to put a TAB between the two characters.

    • #62428

      two ways to tackle this, both effectively use find/replace.

      1) the plug-in by automatication called “multi-find/change” in which find/replace commands can be chained.

      2) using scripts that both ship with indesign and already in the ether thanks to other scripters to effectively do the same thing – chain several find/replace commands. have written a how-to on this blogpage: https://colecandoo.wordpress.co&#8230;..ord-macro/

    • #62429
      hoosier122
      Member

      Thanks. I should add that I do have some experience with C/C++

      I work for a Scripps Newspaper in the sports department. I compile the Scoreboard (Agate) page. There are some pre-packaged Scripps for cleaning up National Basketball Assocation boxscores, soccer scores, league standings, etc… I suppose they were created by someone in the corporate offices.

      My problem is that I would like to cleanup a boxscore (game summary) of a local league. So I think the easiest way will be to edit/modify on of the corporate's scripts.

      Thanks for your help!

    • #62438
      hoosier122
      Member

      pre-packaged scripts* lol

Viewing 5 reply threads
  • You must be logged in to reply to this topic.
Forum Ads