Sponsored Content
Top Forums Shell Programming and Scripting Grepping for hex characters - explanation? Post 302491364 by Scrutinizer on Thursday 27th of January 2011 08:39:35 AM
Old 01-27-2011
This construction can be used in bash and ksh93:
man ksh:
Quote:
A single quoted string preceded by an unquoted $ is processed as an ANSI-C string except
for the following:
\0 Causes the remainder of the string to be ignored.
\E Equivalent to the escape character (ascii 033),
\e Equivalent to the escape character (ascii 033),
\cx Expands to the character control-x.
\C[.name.]
Expands to the collating element name.
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grepping the first 3 characters from a file

Hi I was wondering if it's possible to use a command to get the first 3 characters of a line in a text file, I tried grep but it returns the whole line but I am only interested in the first 3 characters. Is this possible with grep or I need any other command? Also is it possible deleting from... (2 Replies)
Discussion started by: g-e-n-o
2 Replies

2. UNIX for Dummies Questions & Answers

grepping the first 3 characters from a file

give this a try and let me know if it works grep '^' filename rachael (2 Replies)
Discussion started by: rachael
2 Replies

3. Shell Programming and Scripting

Replacing all but last Hex characters in a text line

I must remove hex characters 0A and 0D from several fields within an MS Access Table. Since I don't think it can be done in Access, I am trying here. I am exporting a Table from Access (must be fixed length fields, I think, for my idea to work here) into a text format. I then want to run a... (2 Replies)
Discussion started by: BAH
2 Replies

4. HP-UX

Hex characters of ascii file

Hi, Whats the command or how do you display the hexadecimal characters of an ascii file. thanks Bud (2 Replies)
Discussion started by: budrito
2 Replies

5. Shell Programming and Scripting

Grepping characters

Hi friends, I want your help. I have a flat file. I want a script to search following pattern in it and once it get that pattern it should grep next 7 characters from it and should keep it in output file output.TXT Pattern is RSTD3R0******* In above example, characters in the place of *... (3 Replies)
Discussion started by: anushree.a
3 Replies

6. Programming

After converting the hexstr to Hex and storing the Hex in a char*

Hi All, My main intension of is to convert the Hexstring stored in a char* into hex and then prefixing it with "0x" and suffix it with ',' This has to be done for all the hexstring char* is NULL. Store the result prefixed with "0x" and suffixed with ',' in another char* and pass it to... (1 Reply)
Discussion started by: rvan
1 Replies

7. Shell Programming and Scripting

Replacing hex characters '\x0D' with '\x0D\x0A'

Hello All, I have a requirement where I need to replaced the hex character - '\x0D' with 2 hex characters - 'x0D' & 'x0A' I am trying to use SED - But somehow its not working. Any pointers? Also the hex character '\x0D' can occur anywhere in the line. Can this also be accomplished... (6 Replies)
Discussion started by: paragkalra
6 Replies

8. Shell Programming and Scripting

Convert hex values to displayable characters

Hi, I am a bit stuck with displaying characters. I am having values like below in the proper displayable characters. which I would want to print the actual value on the right hand side. I dont want to create an array because I would have to create 255 different values. isnt there another way of... (17 Replies)
Discussion started by: ahmedwaseem2000
17 Replies

9. UNIX for Dummies Questions & Answers

Replacing hex characters

I have the following file consisting of dates and sample measurements: 05��Oct��2010 1.31�� 06��Oct��2010 1.32�� 07��Oct��2010 1.31�� The hex characters are \xc2\xa0 in sequence. I have tried to remove the characters as follows: sed -i '' -e 's/\xc2\xa0//g' file.dat and as follows... (6 Replies)
Discussion started by: figaro
6 Replies

10. HP-UX

Replacing Hex Characters In A File Using awk?

Hi guys, First off, i'm a complete noob to UNIX and LINUX so apologies if I don't understand the basics! I have a file which contains a hex value of '0D' at the end of each line when I look at it in a hex viewer. I need to change it so it contains a hex value of '0D0A0A' I thought... (10 Replies)
Discussion started by: AndyBSG
10 Replies
term(4) 						     Kernel Interfaces Manual							   term(4)

NAME
term - format of compiled term file SYNOPSIS
DESCRIPTION
Compiled terminfo descriptions are placed under the directory In order to avoid a linear search of a huge HP-UX system directory, a two- level scheme is used: where name is the name of the terminal, and c is the first character of name. Thus, can be found in the file Syn- onyms for the same terminal are implemented by multiple links to the same compiled file. The format has been chosen so that it is the same on all hardware. An 8-bit or longer byte is assumed, but no assumptions about byte ordering or sign extension are made. The compiled file is created using the program (see tic(1M)), and read by the routine. The file is divided into the following six parts: 1. The header section begins the file and contains six short integers in the following format: 1. Magic number (octal 0432); 2. Size, in bytes, of the names section; 3. Number of bytes in the Boolean section; 4. Number of short integers in the numbers section; 5. Number of offsets (short integers) in the strings section; 6. Size, in bytes, of the string table. Short integers are stored in two 8-bit bytes. The first byte contains the least significant 8 bits of the value; the second byte contains the most significant 8 bits. (Thus, the value represented is 256*second+first.) The value -1 is represented by other negative values are illegal. The -1 generally means that a capability is missing from this terminal. Note that this format corresponds to the hardware of the VAX and PDP-11. Machines where this does not correspond to the hardware read the integers as two bytes and compute the result. 2. The terminal names section comes next. It contains the first line of the terminfo description, listing the various names for the terminal, separated by the character. The section is terminated with an ASCII NUL character. 3. In the Boolean section, the Boolean flags have one byte for each flag. This byte is either or as the flag is absent or present, respectively. The capabilities are in the same order as they are listed in the file Between the Boolean section and the number section, a null byte will be inserted, if necessary, to ensure that the number section begins on an even byte. All short integers are aligned on a short word boundary. 4. The numbers section is similar to the flags section. Each capability consists of two bytes, and is stored as a short inte- ger. If the value represented is -1, the capability is considered missing. 5. The strings section is also similar. Each capability is stored as a short integer in the format above. A value of -1 means the capability is missing. Otherwise, the value is taken as an offset from the beginning of the string table. Special char- acters in or notation are stored in their interpreted form, not the printing representation. Padding information and parame- ter information are stored intact in uninterpreted form. 6. The final section is the string table. It contains all the values of string capabilities referenced in the string section. Each string is null terminated. Note that it is possible for to expect a different set of capabilities than are actually present in the file. Either the database might have been updated since has been recompiled (resulting in extra unrecognized entries in the file) or the program may have been recompiled more recently than the database was updated (resulting in missing entries). The routine must be prepared for both possibilities, which is why the numbers and sizes are included. Also, new capabilities must always be added at the end of the lists of Boolean, number, and string capabilities. The following example is an octal dump of the description for the HP Portable Computer (HP-110): 110|hp110|hp110a portable computer, am, xhp, da, db, mir, cols#80, lines#16, lm#0, cbt=Ei, bel=^G, cr= , tbc=E3, clear=E&a0y0CEJ, el=EK, ed=EJ, hpa=E&a%p1%dC, cup=E&a%p1%dy%p2%dC, cud1=EB, cub1=, cuf1=EC, cuu1=EA, cvvis=E&j@, dch1=EP, dl1=EM, smir=EQ, smso=E&dB, sgr0=E&d@, rmir=ER, rmso=E&d@, is2=E&j@, if=/usr/share/lib/tabset/stdcrt, il1=EL, kbs=, kcud1=EB, khome=Eh, kcub1=ED, kcuf1=EC, kcuu1=EA, rmkx=E&s0A, smkx=E&s1A, vpa=E&a%p1%dY, ind= , hts=E1, ht= , 0000 032 001 # 025  223 254 1 1 0 | 0020 h p 1 1 0 | h p 1 1 0 a p o r 0040 t a b l e c o m p u t e r 0060 001 001 001 001 001 0100 P 377 377 020 377 377 377 377 0120 377 377 377 377 003 005 377 377 007 0140 024 027 032 377 377 $ 4 377 377 377 377 0160 7 377 377 377 377 9 377 377 < ? D 0200 G 377 377 377 377 377 377 377 377 377 377 377 377 377 377 0220 377 377 J 377 377 377 377 377 377 M 377 377 377 377 0240 377 377 R 377 377 377 377 W Z 377 377 377 377 0260 377 377 377 377 377 377 _ 377 377 d 377 377 { 0300 377 377 ~ 377 377 377 377 377 377 377 377 377 377 200 0320 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 0340 377 377 377 377 377 377 377 377 377 377 377 377 203 377 377 0360 377 377 206 377 377 377 377 377 377 211 377 377 377 377 0400 377 377 214 217 225 377 377 377 377 377 377 377 377 0420 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 0520 377 377 233 377 377 245 377 377 377 377 247 377 377 0540 252 377 377 377 377 377 377 377 377 377 377 377 377 377 377 0560 377 377 377 377 377 377 377 377 377 377 033 i 007 0600 033 3 033 & a 0 y 0 C 033 J 033 K 0620 033 J 033 & a % p 1 % d C 033 & 0640 a % p 1 % d y % p 2 % d C 033 B 0660  033 C 033 A 033 & j @ 033 P 0700 033 M 033 Q 033 & d B 033 & d @ 0720 033 R 033 & d @ 033 & j @ / u 0740 s r / l i b / t a b s e t / s t 0760 d c r t 033 L  033 B 033 h 1000 033 D 033 C 033 A 033 & s 0 A 033 1020 & s 1 A 033 & a % p 1 % d Y 1040 033 1 1046 WARNINGS
Total compiled entries cannot exceed 4096 bytes. The name field cannot exceed 128 bytes. Hewlett-Packard Company supports only those terminals that are listed on the current list of supported devices. However, both non-sup- ported and supported terminals may be in the terminfo database. If non-supported terminals are used, they may not work correctly. FILES
compiled terminal capability data base SEE ALSO
tic(1M), untic(1M), terminfo(4). term(4)
All times are GMT -4. The time now is 09:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy