Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-22-2011, 06:14 PM   #1
Registered: Nov 2009
Posts: 522

Rep: Reputation: 33
Replace in file


I have a binary file in which I know there is a hex string (xxd myFile | grep b13d4f returns a non empty result, where b13d4f is the string I am talking about.)
How can I replace every occurence (actually there is just one in the file, but just in case) of this hex value with another one?


Last edited by elishac; 09-22-2011 at 06:28 PM.
Old 09-22-2011, 07:47 PM   #2
Senior Member
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Something like:

perl -pi -e 's/\xB1\x3D\x4F/\xDE\xAD\xBE\xEF/' your_file
Tested ok on Fedora...

Last edited by kbp; 09-22-2011 at 07:55 PM.
Old 09-22-2011, 08:30 PM   #3
Registered: Nov 2009
Posts: 522

Original Poster
Rep: Reputation: 33


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to do search & replace on a text file--need to extract URLs from a sitemap file Mountain Linux - General 4 08-07-2015 11:52 AM
[SOLVED] Need help with script to replace certain text in file with part of the file's name kmkocot Linux - Newbie 2 08-23-2009 05:06 PM
Perl find file and then replace string in file moos3 Programming 5 07-29-2009 08:10 AM
replace line in CSV file and rename file connected to that name wademac Linux - Newbie 3 07-15-2009 02:09 PM
Need to replace a file with a newer version but keep the old file via a rename Joe_P Linux - Newbie 4 04-30-2009 04:51 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:01 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration