Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

for a file: trying to sed all hex ff0aff strings to 202020

Status
Not open for further replies.

ytakbob

Programmer
Jul 20, 2000
105
US
any suggestions ?
cant seem o get syntax right


Bob Schmid
bob_schmid@hmis.org
330-746-1010 ext. 1347
 
Hi,

cat /your/file | sed -e 's/ff0aff/202020/g' -e 's/FF0AFF/202020/g' > /your/new_file

line 1 cat the file and pipe it to sed
line 2 execute sed command substitute string/ff0aff/ by /202020/ whith global substitutions along the line
line 3 same as line 2 if the hexa is in upper case
last line redirect the result to a new file
 
I think in the ytakbob's file there are the binary X'FF0AFF' sequence and not the literal values so the sed should be a little different.
They are hexadecimal values and you can specify only octal values FF0AFF will become \377\012\377 so probably it will become:
cat file|sed 's/\377\012\377/ /g' > new_file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top