SLUG Mailing List Archives
Re: [SLUG] perl substitution of metacharacter
- To: r.polanskis@xxxxxxxxxxxxxxxxx
- Subject: Re: [SLUG] perl substitution of metacharacter
- From: "Stuart Cooper" <stucoope@xxxxxxxxx>
- Date: Mon Aug 28 11:36:23 2000
- Cc: slug@xxxxxxxxxxx
I have a little problem that I don't seem to be able to nut
I have a file that's being processed by Perl that has a bunch of
"^@" symbols in it. This is the "Control-at" character.
It's more than that, it's the NUL character, chr(0). ^A is chr(1), ^B
is chr(2)... through to ^Z = chr(26), before that you get ^@ which is
chr(0). See the top of man ascii.
I want to expunge the file of all the "^@" symbols.
My entry in the "neat one liner" competition to do this is:
$ perl -p -i -e "s/\000//g" infile
in the days before Perl you would use sed to do it.