deleting data from text files

Discussion in 'C Programming' started by Cancerbero, Aug 7, 2004.

  1. Cancerbero

    Cancerbero Guest

    Hi.

    I want to delete some chars from a text file. I would like to
    know if this can be done with some "magic" function (for Linux)
    and not rewriting the entire file without the imvolved chars.

    Thanks

    --
    Sebastián Gurin (Cancerbero)
    cancerbero_sgx AT users.sourceforge.net
    Cancerbero, Aug 7, 2004
    #1
    1. Advertising

  2. Cancerbero

    SM Ryan Guest

    Cancerbero <> wrote:
    # Hi.
    #
    # I want to delete some chars from a text file. I would like to
    # know if this can be done with some "magic" function (for Linux)
    # and not rewriting the entire file without the imvolved chars.

    On most systems, the magic doesn't exist. Usually you have to shift the
    bytes around yourself. Some systems do do this, but not many.

    --
    SM Ryan http://www.rawbw.com/~wyrmwif/
    I love the smell of commerce in the morning.
    SM Ryan, Aug 8, 2004
    #2
    1. Advertising

  3. Cancerbero

    CBFalconer Guest

    Cancerbero wrote:
    >
    > I want to delete some chars from a text file. I would like to
    > know if this can be done with some "magic" function (for Linux)
    > and not rewriting the entire file without the imvolved chars.


    No.

    --
    Chuck F () ()
    Available for consulting/temporary embedded and systems.
    <http://cbfalconer.home.att.net> USE worldnet address!
    CBFalconer, Aug 8, 2004
    #3
  4. Cancerbero wrote:
    > Hi.
    >
    > I want to delete some chars from a text file. I would like to
    > know if this can be done with some "magic" function (for Linux)
    > and not rewriting the entire file without the imvolved chars.


    1. Short Answer: No
    2. Longer Answer: Linux-specific functions are off-topic here. The
    general C answer is covered in the FAQ, which you should have checked
    before posting.
    Martin Ambuhl, Aug 8, 2004
    #4
  5. If you don't have to integrate this converter into a C program, you
    can use CodeWorker (http://www.codeworker.org) and the following BNF
    script, called "cancerbero.cwp":

    #implicitCopy // What You Parse Is What You Write
    transform ::=
    // while it remains a char to ignore, jump to the following
    [
    // jump to the following char to ignore
    ->[
    #explicitCopy // don't copy what will be parsed just below
    // recognize a char amongst those to ignore
    #readChar:{"<char1>", "<char2>", ... "<charn>"}
    ]
    ]*
    ->#empty // jump to the end of the file
    ;

    Then, type:
    codeworker -translate cancerbero.cwp <your-input-file>
    <your-resulting-file>

    Cancerbero <> wrote in message news:<>...
    > I want to delete some chars from a text file. I would like to
    > know if this can be done with some "magic" function (for Linux)
    > and not rewriting the entire file without the imvolved chars.
    Cedric LEMAIRE, Aug 9, 2004
    #5
    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. crazyprakash
    Replies:
    4
    Views:
    3,363
    adrian
    Oct 30, 2005
  2. Replies:
    4
    Views:
    937
    M.E.Farmer
    Feb 13, 2005
  3. Harry Barker
    Replies:
    2
    Views:
    507
    Alf P. Steinbach
    Apr 19, 2006
  4. Shaf

    deleting data from a text file

    Shaf, Oct 11, 2004, in forum: Perl Misc
    Replies:
    5
    Views:
    155
    Jürgen Exner
    Oct 12, 2004
  5. crea
    Replies:
    2
    Views:
    398
    Nobody
    Dec 28, 2012
Loading...

Share This Page