Sponsored Content
Top Forums Shell Programming and Scripting Grepping for hex characters - explanation? Post 302491099 by DGPickett on Wednesday 26th of January 2011 05:17:22 PM
Old 01-26-2011
My take is the $ is literal, but regex keep morphing under my feet:

Regular-Expressions.info - Regex Tutorial, Examples and Reference - Regexp Patterns

I usually just use the tab key or ctrl-V ctrl-whatever, in ' ', or $(echo a|tr 'a' '\027') (but my tr only does octal). But I use ksh, this is a bash-ism:
Code:
$ bash <<!
echo $'\x61'
!
a
$


Last edited by DGPickett; 01-26-2011 at 06:32 PM..
 

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
HEXCURSE(1)						      General Commands Manual						       HEXCURSE(1)

NAME
hexcurse - an ncurses-based hex editor SYNOPSIS
hexcurse [ -? | -help ] [ -a ] [ -r rnum ] [ -o outputfile ] [ [ -i ] inputfile ] DESCRIPTION
hexcurse is an ncurses-based hexeditor utility that is able to open, modify, and save a file to disk while providing useful editing and searching options. OPTIONS
-? | -help Prints out the command usage info -a Specifies the addresses to be output in decimal format initially. -r rnum Specifies the number of characters per line that the hexeditor should output. If rnum is either less than 1 or greater than the columns of the current terminal, hexcurse will fill the terminal width, just as if the -r was not specified. -o outputfile Specifies the output file to be written to by default. [-i] inputfile Specifies the input file to be read in. -i is not needed if inputfile is the last argument on the line. INTERACTIVE OPTIONS
F1 | ctrl+? Shows key command help. F2 | ctrl+s Save the current file. F3 | ctrl+o Opens a file. F4 | ctrl+g Goto a certain location in the current file. Depending on which way the addresses are being viewed at the moment, the search will behave differently. If the addresses are currently in hex format, the search will search as if the input was given in hexadecimal format. If the addresses are in decimal format, the function will search for the address in decimal. F5 | ctrl+f Search for a certain string in the current file. Depending on which window the user is currently editing in, this search will behave differently. If editing in the hex window, the input should only be in hexadecimal, and it will search for the hexadecimal "string." If the current editing window is the ASCII window, the input should be ASCII characters, and the search will find that ASCII string in the file. F6 | ctrl+a Switch between hexadecimal address values and decimal address values. F7 | TAB Switch between the hexadecimal and ASCII editing windows. F8 | ctrl+q | ctrl+x Exit out of the program. Page Up | ctrl+u Scroll one 'page' up. Page Down | ctrl+d Scroll one 'page' down. Home | ctrl+t Returns to the top of the file. End | ctrl+b Jumps to the bottom of the file. ctrl+z Undo the last modification. Can be used multiple times. Esc Escapes out of the save, open, goto, and find prompts. SEE ALSO
hexdump(1) , ncurses(3) AUTHORS
The authors of hexcurse are: jewfish <jewfish@jewfish.net> armoth <uknowho@jewfish.net> The current version of this software is always availabe at http://www.jewfish.net/software.php BUGS
On some terminals the function keys will not work. Support for resizable terminals is still a bit rudimentary. At this time, when the terminal is resized, the cursor is positioned at the beginning of the file. This will be corrected in the next release. There is also an issue where the labels on the bottom of the screen do not resize correctly. A fix for the latter is in the works. To report a bug or problem, please e-mail: devel@jewfish.net TODO
When we get the time, we would like to implement the ability to insert and delete data from the file. Please e-mail us with any additional suggestions. 22 December 2003 HEXCURSE(1)
All times are GMT -4. The time now is 02:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy