Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Tue Jun 06, 2023 8:18 am


Tips & Tricks, Questions regarding shell scripts, awk, perl, sed and much more.

Author Message
admin
Post  Post subject: PERL: How to replace non-ascii characters/bytes in a file  |  Posted: Fri Apr 10, 2015 8:58 am
Site Admin

Joined: Mon Aug 03, 2009 8:43 am
Posts: 104

Offline
 

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

_________________
VPSie - SSD VPS servers in AMS-IX, LINX, DE-CIX
https://vpsie.com





Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "PERL: How to replace non-ascii characters/bytes in a file"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. How to replace new line in perl script

mandrei99

1

4930

Wed Jun 26, 2013 8:18 am

admin View the latest post

There are no new unread posts for this topic. Removing new line / EoL characters in a PERL script

mandrei99

0

4405

Mon Nov 04, 2013 6:47 am

mandrei99 View the latest post

There are no new unread posts for this topic. How to replace dot or any character with AWK

mandrei99

0

15893

Tue Jan 28, 2014 6:35 am

mandrei99 View the latest post

There are no new unread posts for this topic. AWK: How to replace a newline with actual \n

admin

0

2504

Thu Jul 20, 2017 11:02 am

admin View the latest post

There are no new unread posts for this topic. Unix shell - using TR to replace new lines with spaces

debuser

0

8832

Thu Feb 25, 2010 8:08 am

debuser View the latest post

There are no new unread posts for this topic. How to replace \w SED multiple matches on the same line without piping

mandrei99

0

3448

Tue Oct 08, 2013 6:29 am

mandrei99 View the latest post

There are no new unread posts for this topic. Attachment(s) Juniper SRX - Perl script - SNMP based RRDtool graphis from CPU usage and Flow Session (current)

mandrei99

1

5960

Mon Nov 04, 2013 11:47 am

mandrei99 View the latest post

There are no new unread posts for this topic. grep match pattern: Binary file bincharacters.txt matches - How to make grep treat a file as text

mandrei99

0

2427

Wed Dec 11, 2013 7:15 am

mandrei99 View the latest post

There are no new unread posts for this topic. BASH shell script to mointor a directory and move file without overwriting destination

admin

0

2525

Wed Nov 15, 2017 7:48 am

admin View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
cronNews News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO