Re: Replacing characters in file
- From: "Jürgen Exner" <jurgenex@xxxxxxxxxxx>
- Date: Wed, 28 Mar 2007 05:42:39 GMT
Anony-mouse wrote:
In article <%7iOh.1641$Rp2.877@trndny04>, "Jürgen Exner"
<jurgenex@xxxxxxxxxxx> wrote:
Anony-mouse wrote:
In article <Z9aOh.3620$J21.675@trndny03>, "Jürgen Exner"
If on the other hand you don't have a text file, then maybe it is
time to stop treating it as a text file but start handling it as a
binary file instead.
It's not a text file. As I said it's a .DAT file
Whatever that is supposed to mean.
A file name ending of .DAT doesn't imply anything as to the content
of the file.
Although not necessarily true, it does imply that it's not a simple
.TXT file.
Well, the file ending has no bearing on the content of a file. So, yes and
so what?
that contains control
characters, including EOF ones. :o\
Well, if it is not a text file but a binary file, then it isn't very
meaningful to talk about characters.
It would have been much less confusing if you had said "I have a
two-byte sequence"01 5F" (denoted in hex) and like to replace it
with "01 5C".
Symantics (or pendaticism, whichever you prefer).
Not really. Computers are notorious at being extremely pedantic. You will
have much success when dealing with computers if you adapt a precise
language, too.
It still means the
same thing
Well, it doesn't. A character and a byte are two very different things. And
a text file and data/binary file are two very different things, too.
and some people seem to have understood what I was saying,
Some people are better in guessing than others.
while others simply want to get picky about terminology.
As I mentioned, terminology is important when dealing with something as
pedantic as computers.
I still don't understand why a simply
s/\x01\x5F/\x01\x5C/g
shouldn't work.
It doesn't work in SED because SED aborts when it hits the first EOF
character and so doesn't complete the file.
Not surprising. AFAIK SED is designed to work for text files and files that
contain text by definition don't have any content after an EOF. Do you now
realize how important the distinction between text and binary files is
sometimes?
In the version of Perl I've been using it simply does nothing - I get
a completely empty result file.
And which version would that be?
perl -v
jue
I'll have to wait until I finish
downloading Active Perl and see what happens there, but that may be
too big in filesize for my needs.
_
_/ \___
Anony-mouse says o_/O _/ \
"Eek-eek-eek!" \__/_|_/_|\____/
.
- References:
- Replacing characters in file
- From: Anony-mouse
- Re: Replacing characters in file
- From: Dr.Ruud
- Re: Replacing characters in file
- From: Anony-mouse
- Re: Replacing characters in file
- From: Dr.Ruud
- Re: Replacing characters in file
- From: Anony-mouse
- Re: Replacing characters in file
- From: John W. Krahn
- Re: Replacing characters in file
- From: Anony-mouse
- Re: Replacing characters in file
- From: Jürgen Exner
- Re: Replacing characters in file
- From: Anony-mouse
- Re: Replacing characters in file
- From: Jürgen Exner
- Re: Replacing characters in file
- From: Anony-mouse
- Replacing characters in file
- Prev by Date: Re: Beginning OO help
- Next by Date: Re: Troubleshooting cpan
- Previous by thread: Re: Replacing characters in file
- Next by thread: Re: Replacing characters in file
- Index(es):
Relevant Pages
|