Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides
https://forum.ivorde.com/

PERL: How to replace non-ascii characters/bytes in a file
https://forum.ivorde.com/perl-how-to-replace-non-ascii-characters-bytes-in-a-file-t19795.html
Page 1 of 1

Author:  admin [ Fri Apr 10, 2015 8:58 am ]
Post subject:  PERL: How to replace non-ascii characters/bytes in a file

To remove a non-ascii 9B byte in a file:


Code:
perl -i.bak -pe 's/\x9B//g' file.txt


To replace a non-ascii 9B byte with a new line:


Code:
perl -i.bak -pe 's/\x9B/\x0A/g' file.txt

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/