File System Object

Discussion in 'ASP General' started by JP SIngh, Jul 15, 2004.

  1. JP SIngh

    JP SIngh Guest

    Can some tell me how can I search for a particular block of text within the
    file and delete it?

    Section of the file I want to change looks like the one below and I want all
    the lines starting with dteHolidays[ deleted?

    /* INSERT HOLIDAYS HERE!
    */

    dteHolidays[0] = new Date("01/01/2004"); // CHRISTMAS DAY
    dteHolidays[1] = new Date("04/09/2004"); // Good Friday
    dteHolidays[2] = new Date("04/12/2004"); // Easter Monday


    Any help

    thanks
    JP SIngh, Jul 15, 2004
    #1
    1. Advertising

  2. Any time you have a file, you have two options.

    1. Read in line by line and parse out what you do not want (or replace).
    With the ASP/COM FSO, the easiest method is to write to another file
    location and copy back in.

    2. Read in the entire file, as a chunk and replace. Then save on top of the
    old file. With large files this may end up being rather clunky.

    Better option:
    Add a routine that looks up the info you want and have it called from within
    the page. When there is no data to show, return an empty string.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    ************************************************
    Think Outside the Box!
    ************************************************
    "JP SIngh" <> wrote in message
    news:...
    > Can some tell me how can I search for a particular block of text within

    the
    > file and delete it?
    >
    > Section of the file I want to change looks like the one below and I want

    all
    > the lines starting with dteHolidays[ deleted?
    >
    > /* INSERT HOLIDAYS HERE!
    > */
    >
    > dteHolidays[0] = new Date("01/01/2004"); // CHRISTMAS DAY
    > dteHolidays[1] = new Date("04/09/2004"); // Good Friday
    > dteHolidays[2] = new Date("04/12/2004"); // Easter Monday
    >
    >
    > Any help
    >
    > thanks
    >
    >
    >
    Cowboy \(Gregory A. Beamer\) [MVP], Jul 15, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kathy Burke
    Replies:
    2
    Views:
    5,143
    Kevin Spencer
    Aug 1, 2003
  2. Showjumper
    Replies:
    2
    Views:
    1,805
    Showjumper
    Aug 2, 2003
  3. Imran Aziz
    Replies:
    4
    Views:
    8,702
    ljenner01
    Jan 19, 2011
  4. keithb
    Replies:
    3
    Views:
    18,585
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    May 7, 2006
  5. Replies:
    0
    Views:
    894
Loading...

Share This Page