in reply to Null \x00 being replaced by space \x20
Hello BaldGorilla, and welcome to the Monastery!
I assume the line print $new_gpd_fh "$line"; is meant to be print $new_fh "$line";? With this change made, I cannot reproduce your problem.
Specifically, I created a text file, then used a hex editor to insert a null (\x00) at a suitable place in the text, and ran the script. The resulting new file has a null character in the correct place, as expected. (Confirmed both in the hex editor and in Notepad++, which displays a NUL control character.)
Are you sure that your new file contains a space character in place of the null? Or could the space you are seeing be an artefact of the way you are viewing the file contents?
Cheers,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Null \x00 being replaced by space \x20
by BaldGorilla (Initiate) on Nov 10, 2018 at 04:18 UTC | |
by syphilis (Archbishop) on Nov 10, 2018 at 06:56 UTC | |
by BaldGorilla (Initiate) on Nov 12, 2018 at 19:20 UTC |