VIM removal of Unicode ('bomb')
Gabor Szabo
szabgab at gmail.com
Wed Feb 4 18:44:34 IST 2009
On Wed, Feb 4, 2009 at 4:53 PM, Noam Rathaus <noamr at beyondsecurity.com> wrote:
> I am using:
> VIM - Vi IMproved 6.1 (2002 Mar 24, compiled Jan 15 2003 08:05:27)
>
> And I have a few unicode characters (unicode encoding 'bomb'/marker) at the
> beginning of the file that I want to remove.
> 0000000 bbef 3cbf 4421 434f 5954 4550 6820 6d74
>
> I m referring to 0xbb, 0xef, 0x3c, 0xbf
>
> I would to remove them, but opening the file with vim doesn't show them - as
> they are markers it hides.
>
> Can anyone help me get rid of them?
>
> Any solution (not just using VIM) would be great.
>
try this one:
perl -i.bak -0777 -pe 's/^\xbb\xef\x3c\xbf//' file.txt
it will also create a backup file with .bak extension
see perldoc perlrun
Gabor
--
Gabor Szabo http://szabgab.com/blog.html
Perl Training in Israel http://www.pti.co.il/
Test Automation Tips http://szabgab.com/test_automation_tips.html
More information about the Linux-il
mailing list