Sponsored Content
Top Forums Shell Programming and Scripting replace string in binary file Post 53900 by sg1207 on Wednesday 28th of July 2004 04:17:57 AM
Old 07-28-2004
replace string in binary file

Dear all,

How can replace special string with another string in binary file?

Thanks&Best Regards
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split a binary file into 2 basing on 2 delemiter string

Hi all, I have a binary file (orig.dat) and two special delimiter strings 'AAA' and 'BBB'. My binary file's content is as follow: <Data1.1>AAA<Data1.2>BBB <Data2.1>AAA<Data2.2>BBB ... <DataN.1>AAA<DataN.2>BBB DataX.Y might have any length, and contains any kind of special/printable... (1 Reply)
Discussion started by: Averell
1 Replies

2. Shell Programming and Scripting

replace (sed?) a single line/string in file with multiple lines (string) from another file??

Can someone tell me how I can do this? e.g: Say file1.txt contains: today is monday the 22 of NOVEMBER 2010 and file2.txt contains: the 11th month of How do i replace the word NOVEMBER with (5 Replies)
Discussion started by: tuathan
5 Replies

3. UNIX for Advanced & Expert Users

Insert string in binary file at top

How can i append a EBCDIC string of 100 bytes to 0th position of a binary file in UNIX. (4 Replies)
Discussion started by: param_it
4 Replies

4. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

5. Solaris

A string in a binary file

hi experts, anyone knows how can i find a string in a multiple binary files in a multiple directories and display the file name containing the string? i mean i have lots of folders with binary files and i am looking for specific string within one of these files i would like to know the right... (6 Replies)
Discussion started by: q8devilish
6 Replies

6. Shell Programming and Scripting

Regex and backreference to replace in binary file

Hello to all, I have this sed script that replaces hex strins within a binary file. As you can see, I want to replace all bytes 4X with 2X (where X could take values 0 to F). sed -e 's/\x40/\x20/g' -e 's/\x41/\x21/g' -e 's/\x42/\x22/g' -e 's/\x43/\x23/g' -e 's/\x44/\x24/g' -e... (7 Replies)
Discussion started by: Ophiuchus
7 Replies

7. Programming

C program to read a binary file and search for a string?

Hi, I am not a C programmer. The only C exposure I have is reading and completing the exercises from the C (ANSI C ) Programming Language book:o At the moment, I am using the UNIX strings command to extract information for a binary file and grepping for a particular string and the value... (3 Replies)
Discussion started by: newbie_01
3 Replies

8. UNIX for Dummies Questions & Answers

Search for a string,delete the line and replace with new string in a file

Hi Everyone, I have a requirement in ksh where i have a set of files in a directory. I need to search each and every file if a particular string is present in the file, delete that line and replace that line with another string expression in the same file. I am very new to unix. Kindly help... (10 Replies)
Discussion started by: Pradhikshan
10 Replies

9. Shell Programming and Scripting

Replace string of a file with a string of another file for matches using grep,sed,awk

I have a file comp.pkglist which mention package version and release . In 'version change' and 'release change' line there are two versions 'old' and 'new' Version Change: --> Release Change: --> cat comp.pkglist Package list: nss-util-devel-3.28.4-1.el6_9.x86_64 Version Change: 3.28.4 -->... (1 Reply)
Discussion started by: Paras Pandey
1 Replies

10. UNIX for Beginners Questions & Answers

Search partial string in a file and replace the string - UNIX

I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this. string(Scenario 1)- user::r--,user::ourfrd:r-- String(Scenario 2)- user::r-- File **** # file: /local/Desktop/myfile # owner: me # group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
GIT-REPLACE(1)							    Git Manual							    GIT-REPLACE(1)

NAME
       git-replace - Create, list, delete refs to replace objects

SYNOPSIS
       git replace [-f] <object> <replacement>
       git replace [-f] --edit <object>
       git replace [-f] --graft <commit> [<parent>...]
       git replace -d <object>...
       git replace [--format=<format>] [-l [<pattern>]]

DESCRIPTION
       Adds a replace reference in refs/replace/ namespace.

       The name of the replace reference is the SHA-1 of the object that is replaced. The content of the replace reference is the SHA-1 of the
       replacement object.

       The replaced object and the replacement object must be of the same type. This restriction can be bypassed using -f.

       Unless -f is given, the replace reference must not yet exist.

       There is no other restriction on the replaced and replacement objects. Merge commits can be replaced by non-merge commits and vice versa.

       Replacement references will be used by default by all Git commands except those doing reachability traversal (prune, pack transfer and
       fsck).

       It is possible to disable use of replacement references for any command using the --no-replace-objects option just after git.

       For example if commit foo has been replaced by commit bar:

	   $ git --no-replace-objects cat-file commit foo

       shows information about commit foo, while:

	   $ git cat-file commit foo

       shows information about commit bar.

       The GIT_NO_REPLACE_OBJECTS environment variable can be set to achieve the same effect as the --no-replace-objects option.

OPTIONS
       -f, --force
	   If an existing replace ref for the same object exists, it will be overwritten (instead of failing).

       -d, --delete
	   Delete existing replace refs for the given objects.

       --edit <object>
	   Edit an object's content interactively. The existing content for <object> is pretty-printed into a temporary file, an editor is
	   launched on the file, and the result is parsed to create a new object of the same type as <object>. A replacement ref is then created
	   to replace <object> with the newly created object. See git-var(1) for details about how the editor will be chosen.

       --raw
	   When editing, provide the raw object contents rather than pretty-printed ones. Currently this only affects trees, which will be shown
	   in their binary form. This is harder to work with, but can help when repairing a tree that is so corrupted it cannot be pretty-printed.
	   Note that you may need to configure your editor to cleanly read and write binary data.

       --graft <commit> [<parent>...]
	   Create a graft commit. A new commit is created with the same content as <commit> except that its parents will be [<parent>...] instead
	   of <commit>'s parents. A replacement ref is then created to replace <commit> with the newly created commit. See
	   contrib/convert-grafts-to-replace-refs.sh for an example script based on this option that can convert grafts to replace refs.

       -l <pattern>, --list <pattern>
	   List replace refs for objects that match the given pattern (or all if no pattern is given). Typing "git replace" without arguments,
	   also lists all replace refs.

       --format=<format>
	   When listing, use the specified <format>, which can be one of short, medium and long. When omitted, the format defaults to short.

FORMATS
       The following format are available:

       o   short: <replaced sha1>

       o   medium: <replaced sha1> -> <replacement sha1>

       o   long: <replaced sha1> (<replaced type>) -> <replacement sha1> (<replacement type>)

CREATING REPLACEMENT OBJECTS
       git-filter-branch(1), git-hash-object(1) and git-rebase(1), among other git commands, can be used to create replacement objects from
       existing objects. The --edit option can also be used with git replace to create a replacement object by editing an existing object.

       If you want to replace many blobs, trees or commits that are part of a string of commits, you may just want to create a replacement string
       of commits and then only replace the commit at the tip of the target string of commits with the commit at the tip of the replacement string
       of commits.

BUGS
       Comparing blobs or trees that have been replaced with those that replace them will not work properly. And using git reset --hard to go back
       to a replaced commit will move the branch to the replacement commit instead of the replaced commit.

       There may be other problems when using git rev-list related to pending objects.

SEE ALSO
       git-hash-object(1) git-filter-branch(1) git-rebase(1) git-tag(1) git-branch(1) git-commit(1) git-var(1) git(1)

GIT
       Part of the git(1) suite

Git 2.17.1							    10/05/2018							    GIT-REPLACE(1)
All times are GMT -4. The time now is 09:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy