Sponsored Content
Top Forums Shell Programming and Scripting how to get data from hex file using SED or AWK based on pattern sign Post 302563573 by alister on Tuesday 11th of October 2011 03:02:37 PM
Old 10-11-2011
Quote:
Originally Posted by sameucho
I have a binary (hex) file
I was able to understand your data's description, but its format is unclear to me. Is it a binary file or a text file with hex-encoded data?

To be as clear as possible, why don't you post the output of hexdump -C datafile. If it's a large amount of data, just include a couple of samples of portions that match the bytes you need help extracting. This way, we can be sure we understand each other.

Regards,
Alister
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Split a file based on pattern in awk, grep, sed or perl

Hi All, Can someone please help me write a script for the following requirement in awk, grep, sed or perl. Buuuu xxx bbb Kmmmm rrr ssss uuuu Kwwww zzzz ccc Roooowwww eeee Bxxxx jjjj dddd Kuuuu eeeee nnnn Rpppp cccc vvvv cccc Rhhhhhhyyyy tttt Lhhhh rrrrrssssss Bffff mmmm iiiii Ktttt... (5 Replies)
Discussion started by: kumarn
5 Replies

2. Shell Programming and Scripting

Truncating FILE data BASED ON A PATTERN

HI I HAVE A PROBLEM,MY SOURCE FILE IS OF PATTERN S1,E-Certified,29,29,2.7,Certified,4,3,2.7,,0,0,0 S2,Certified,4,3,2.7,,0,0,0,,0 S3,E-Certified,29,29,2.7,,0,0,0 S4,,0,0,0,,0,0,0,,0,0,0,,0,0,0 AND THE EXPECTED OUTPUT IS S1,E-Certified,29,29,2.7 S1,Certified,4,3,2.7... (1 Reply)
Discussion started by: pkumar3
1 Replies

3. Shell Programming and Scripting

Merge two file data together based on specific pattern match

My input: File_1: 2000_t g1110.b1 abb.1 2001_t g1111.b1 abb.2 abb.2 g1112.b1 abb.3 2002_t . . File_2: 2000_t Ali england 135 abb.1 Zoe british 150 2001_t Ali england 305 g1111.b1 Lucy russia 126 (6 Replies)
Discussion started by: patrick87
6 Replies

4. Shell Programming and Scripting

Sed or awk : pattern selection based on special characters

Hello All, I am here again scratching my head on pattern selection with special characters. I have a large file having around 200 entries and i have to select a single line based on a pattern. I am able to do that: Code: cat mytest.txt | awk -F: '/myregex/ { print $2}' ... (6 Replies)
Discussion started by: usha rao
6 Replies

5. Shell Programming and Scripting

sed/awk : how to delete lines based on IP pattern ?

Hi, I would like to delete lines in /etc/hosts on few workstations, basically I want to delete all the lines for a list of machines like this : for HOST in $(cat stations.lst |uniq) do # echo -n "$HOST" if ping -c 1 $HOST > /dev/null 2>&1 then HOSTNAME_val=`rsh $HOST "sed... (3 Replies)
Discussion started by: albator1932
3 Replies

6. UNIX for Dummies Questions & Answers

using sed delete a line from csv file based on specific data in two separate fields

Hello, :wall: I have a 12 column csv file. I wish to delete the entire line if column 7 = hello and column 12 = goodbye. I have tried everything that I can find in all of my ref books. I know this does not work /^*,*,*,*,*,*,"hello",*,*,*,*,"goodbye"/d Any ideas? Thanks Please... (2 Replies)
Discussion started by: Chris Eagleson
2 Replies

7. Shell Programming and Scripting

Precede and Append characters using sed/awk based on a pattern

I have an input file which is similar to what I have shown below. Pattern : Data followed by two blank lines followed by data again followed by two blank lines followed by data again etc.. The first three lines after every blank line combination(2 blank lines between data) should be... (2 Replies)
Discussion started by: bikerboy
2 Replies

8. Shell Programming and Scripting

awk to insert missing string based on pattern in file

Using the file below, which will always have the first indicated by the digit after the - and last id in it, indicated by the digit after the -, I am trying to use awk to print the missing line or lines in file following the pattern of the previous line. For example, in the file below the next... (4 Replies)
Discussion started by: cmccabe
4 Replies

9. Shell Programming and Scripting

awk to update value based on pattern match in another file

In the awk, thanks you @RavinderSingh13, for the help in below, hopefully it is close as I am trying to update the value in $12 of the tab-delimeted file2 with the matching value in $1 of the space delimeted file1. I have added comments for each line as well. Thank you :). awk awk '$12 ==... (10 Replies)
Discussion started by: cmccabe
10 Replies

10. Shell Programming and Scripting

Copy data to new file based on input pattern

Hi All, I want to create a new file based on certain conditions and copy only those conditioned data to new file. Input Data is as it looks below. ORDER|Header|Add|32|32|1616 ORDER|Details1......... ORDER|Details2......... ORDER|Details3......... ORDER|Details4............ (10 Replies)
Discussion started by: grvk101
10 Replies
NetSDS::Util::Convert(3pm)				User Contributed Perl Documentation				NetSDS::Util::Convert(3pm)

NAME
NetSDS::Util::Convert - data formats conversion functions SYNOPSIS
use NetSDS::Util::Convert qw(...); DESCRIPTION
"NetSDS::Util::Convert" module contains miscelaneous functions. o CLI parameters processing o types validation o HEX, Base64, URI, BCD encondig o UUID processing EXPORTED FUNCTIONS
conv_conv_str_bcd($str) - convert string to little-endian BCD This function converts string to little-endian BCD encoding filled with F16 value. conv_chr_hex($char) - encode char to hexadecimal string $hex = conv_chr_hex('a'); # return 61 conv_hex_chr($hex) - convert hexadecimal string to character $chr = conv_hex_chr('4A'); # return 'J' conv_str_hex($str) - convert byte string to hexadecimal $str = 'Want hex dump!'; $hex = conv_hex_str($str); print "Hex string: " . $hex; conv_hex_str($string) - convert hex to byte string $hex = '7A686F7061'; $string = conv_hex_str($hex); print "String from hex: " . $string; conv_str_base64($str) - convert string to Base64 my $b64 = str_base64("Hallo, people!"); conv_base64_str($b64) - convert Base64 to string my $str = base64_str($base64_string); conv_str_uri($str) - convert string to URI encoded Example: my $uri = str_uri("http://www.google.com/?q=what"); conv_uri_str($uri) - decode URI encoded string Example: my $str = uri_str($uri_string); EXAMPLES
None BUGS
None TODO
1. Add other encodings support SEE ALSO
Pod::Usage, Data::UUID AUTHORS
Valentyn Solomko <pere@pere.org.ua> Michael Bochkaryov <misha@rattler.kiev.ua> perl v5.12.4 2011-08-27 NetSDS::Util::Convert(3pm)
All times are GMT -4. The time now is 11:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy