deleting data from text files

C

Cancerbero

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
 
S

SM Ryan

# 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.
 
C

CBFalconer

Cancerbero said:
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.
 
M

Martin Ambuhl

Cancerbero said:
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.
 
C

Cedric LEMAIRE

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top