Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Using sed to split hex string Post 303037249 by drl on Saturday 27th of July 2019 08:15:18 AM
Old 07-27-2019
Hi.
Code:
echo "1C 50 A9 D3 8B B0 24 9C 14 1C 50 A9 D3 8B B0 24" |
fold -12 |
sed '2~2a\
'

producing:
Code:
1C 50 A9 D3 
8B B0 24 9C 

14 1C 50 A9 
D3 8B B0 24

Where the GNU extension '2~2' starts with line 2, then after each 2nd line adds a newline.

On a system like:
Code:
OS, ker|rel, machine: Linux, 3.16.0-7-amd64, x86_64
Distribution        : Debian 8.11 (jessie) 
bash GNU bash 4.3.30
fold (GNU coreutils) 8.23
sed (GNU sed) 4.2.2

Best wishes ... cheers, drl

Last edited by drl; 07-27-2019 at 09:25 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

converting character string to hex string

HI Hi I have a character string which contains some special characters and I need it to display as a hex string. For example, the sample i/p string: ×¥ïA Å gïÛý and the o/p should be : D7A5EF4100C5010067EFDBFD Any pointers or sample code pls. (5 Replies)
Discussion started by: axes
5 Replies

2. Shell Programming and Scripting

Match hex value in string (Perl)

I am trying to match a character return from a website so that I can replace it. It is the '...' character (didnt even know it existed initially). The character apparently has the hex value of 2026, but in the script, attempting to substitute regular 3 periods is not working. What am I... (2 Replies)
Discussion started by: Guyverix
2 Replies

3. Programming

Hex string conversion?

Hello all. I need help... How can I cenvert this 42ec93df826c804ea531c56594db453d54daad4b to normal text? What convertor I have to use? Thanks. (12 Replies)
Discussion started by: escudo
12 Replies

4. Programming

how to use hex escape char with string in C?

I want it to ouput "abcd", but it dosen't. 1 #include<stdio.h> 2 int main() 3 { 4 printf("a\x62cd"); 5 } 6 gcc alarm.c -o alarm alarm.c: In function 'main': alarm.c:4:9: warning: hex escape sequence out of range It seems that the complier joint "cd" as part of... (8 Replies)
Discussion started by: vistastar
8 Replies

5. Shell Programming and Scripting

split string using sed, perl

How can I split following input into stwo strings: Input: 1^~^2^~^3^~^4^~^5^~^6^~^7^~^8^~^9 Output: $string1 = 1^~^2^~^ $string2 = 3^~^4^~^5^~^6^~^7^~^8^~^9 Note: the length of string may vary, say upto 15. String 1 will contain only first two. string2 will contain... (10 Replies)
Discussion started by: som.nitk
10 Replies

6. Shell Programming and Scripting

String to HEX conversion in UNIX

i have this below string which i need to convert it to HEX. i have already tried it but it showing extra few things on it.. let me show what i have done and what is the output i am getting and what is the desired output the input string is "!\"\"\"\"\"\"\"!\"\"\"\"\"\"\"" which is... (4 Replies)
Discussion started by: vivek d r
4 Replies

7. Shell Programming and Scripting

How to replace with "sed" some hex values by other hex values?

Assume I have a file \usr\home\\somedir\myfile123.txt and I want to replace all occurencies of the two (concatenated) hex values x'AD' x'A0' bytwo other (concatenated) hex values x'20' x'6E' How can I achieve this with the gnu sed tool? Additional question: Is there a way to let sed show... (1 Reply)
Discussion started by: pstein
1 Replies

8. Shell Programming and Scripting

ksh : split hex number group

Hi, sry for poor english I have a group of hex number as : 4D40:4D42 I want so split this group in a list as : 4D40,4D41,4D42 i don't know how i can do this in ksh Thanks (5 Replies)
Discussion started by: jocazh
5 Replies

9. Shell Programming and Scripting

Find and increment value in string of hex

I have a long string of hex (from ASN.1 data) where I need to find and change a particular hex value only and increment it. The hex pairs either side (84 and a7) of the value to increment will remain constant. i.e. "84 <length> <value_to_increment> a7" starting with 00. So end result: ... (11 Replies)
Discussion started by: securegooner
11 Replies

10. Shell Programming and Scripting

sed split string

Greetings, i have a string that looks like Network "123" "ABC" i need to make it look like: Network "123" Network "ABC" Help please? Thanks again Please use CODE tags when displaying sample input, sample output, and code segments (as required by forum rules). (2 Replies)
Discussion started by: hoyanet
2 Replies
HEX2BDF-SPLIT(1)					      General Commands Manual						  HEX2BDF-SPLIT(1)

NAME
hex2bdf-split - Convert a GNU Unifont .hex file into single-width BDF fonts. SYNOPSIS
hex2bdf-split n < input_font.hex > halfwidth_output_font.bdf hex2bdf-split y < input_font.hex > fullwidth_output_font.bdf DESCRIPTION
hex2bdf-split reads a sorted GNU Unifont .hex file (sorted with the Unix sort utility) from stdin and writes a BDF version of the font to stdout. This utility was adapted from the original hex2bdf script to accomodate charcell behavior in older X11 implementations. It is present for historical reasons, but will probably be removed in a future distribution. Dependency on this program is discouraged. The main software application written to use the GNU Unifont, the international editor Yudit, does not need a split font. In addition, the GNU Unifont now has a TrueType version that makes most other use of the BDF version obsolete. hex2bdf-split takes one argument: "y" or "n". If "n" is specified, the output font is set to half-width (8 pixels wide) and "-h-" (for half-width) appears as the X Logical Font Descriptor (XLFD) ADD_STYLE_NAME value. If "y" is specified, the output font is set to full- width (16 pixels wide), and "-f-" (for full-width) appears as the X Logical Font Descriptor (XLFD) ADD_STYLE_NAME value. FILES
*.hex GNU Unifont font files SEE ALSO
bdfimplode(1), hex2bdf(1), hex2sfd(1), hexbraille(1), hexdraw(1), hexmerge(1), johab2ucs2(1), unibmp2hex(1), unicoverage(1), unidup(1), unihex2bmp(1), unipagecount(1), uniunmask(1) AUTHOR
hex2bdf-split was written by David Starner, based upon the original hex2bdf Perl script by Roman Czyborra. LICENSE
hex2bdf-split is Copyright (C) 1999 David Starner, and is released under the following terms (taken from http://czyborra.com/): "All of my works you find here are freeware. You may freely copy, use, quote, modify or redistribute them as long as you properly attribute my contribution and have given a quick thought about whether Roman might perhaps be interested to read what you did with his stuff. Hori- zontal rules don't apply." BUGS
No known bugs exist. 2008 Jul 06 HEX2BDF-SPLIT(1)
All times are GMT -4. The time now is 05:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy