LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-07-2012, 08:32 AM   #1
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Rep: Reputation: 0
How to insert a string into a binary file


I want insert actual string into binary file, not the acsii value of the string

Its kind of xxd -r, but I am not getting intended result.
how can i do that ?
 
Old 11-07-2012, 08:58 AM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
What exactly are you trying to accomplish? Adding anything to a binary file will likely corrupt the file and make whatever program that reads the file unable to read it.

You can append text to any file with the >> shell operator. but again your file will be corrupt.

Code:
echo "appended text" >> somebinary
You can probably get away with replacing text in a binary so long as the text is the same length before and after.
 
Old 11-07-2012, 08:59 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,679

Rep: Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893Reputation: 5893
Reference:
http://www.linuxquestions.org/questi...le-4175436027/
 
  


Reply



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 use Vi to match a string of text, add a new line, insert string... Slycraft Linux - Newbie 7 07-20-2012 10:24 AM
[SOLVED] How to insert binary value into array with fixed length of 10 digits jamesd_burgess Linux - Newbie 4 01-09-2012 01:49 PM
Help: Opening GenICs binary file, writing to binary file for GADGET-2 (in C) parallax147 Programming 0 10-05-2010 11:06 AM
Script to insert string in first line of a file minil Programming 13 01-02-2006 11:56 PM
Java read binary file in as string for RegEx mulciber Programming 1 12-18-2005 12:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:12 AM.

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