Sponsored Content
Full Discussion: Hex numbering sequence
Top Forums Shell Programming and Scripting Hex numbering sequence Post 302458861 by bartus11 on Saturday 2nd of October 2010 08:34:18 AM
Old 10-02-2010
Code:
echo 036A 4 2 | perl -ane '$F[0]=hex $F[0];for ($j=0;$j<$F[2];$j++){printf "%s%.4X%s","Group ID ",$F[0]++,", members below;\n";for ($i=1;$i<$F[1];$i++){printf "%.4X\n",$F[0]++}}'

This User Gave Thanks to bartus11 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Numbering!

Just a shot question... how to make 1,2,3,...999 into the form of 001,002,003....999 (3 digits) Thanks.... (9 Replies)
Discussion started by: biglemon
9 Replies

2. Shell Programming and Scripting

Numbering

I'm trying to do a script that will look for a log file if it is already there change the name to another name. I.E if log.0 is there rename to log.1 rename log.1 to log.2 rename log.2 to log.3 and so on. Only thing is I got no idea where or what is the best command to use for this? ... (3 Replies)
Discussion started by: merlin
3 Replies

3. UNIX for Advanced & Expert Users

numbering blanks

hello i'm trying to figure out how to number a blank line. For instance this : sed '/./=' file | sed '/./N; s/\n/ /' gives me 1 aaaa 2 bbbbbb 4 cccccc 5 ffkkkfff 6 ffsdfdfs I would like something like this: 1 aaaaa 2 3 bbbbbb 4 5 cccccc And so... (6 Replies)
Discussion started by: wisher115
6 Replies

4. Shell Programming and Scripting

Reverse numbering of image sequence

Hi, I have several folders full of image sequences from an animation. The image frames are named Frame0001.png to Frame0900.png, somewhere along the way the images have been named in reverse order. Is there a script that read the contents of a folder and renumber the files Frame0001.png -... (1 Reply)
Discussion started by: BlightyDevil
1 Replies

5. 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

6. Programming

What is the difference between ios::hex and std::hex?

Hi, Is there really a difference between these two, std::hex and ios::hex?? I stumbled upon reading a line, "std::ios::hex is a bitmask (8 on gcc) and works with setf(). std::hex is the operator". Is this true? Thanks (0 Replies)
Discussion started by: royalibrahim
0 Replies

7. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

8. Shell Programming and Scripting

Incremental numbering?

Would it be possible for a script to duplicate a file and incrementally number it? File in: XXX_007_0580_xxxx_v0016.aep File out: XXX_007_0580_xxxx_v0017.aep If someone knows of a way I'd love to see it. Thanks! (7 Replies)
Discussion started by: scribling
7 Replies

9. Shell Programming and Scripting

Hex number sequence help

Need some help doing this ... with awk maybe Input 0DF6 0DF7 0DF8 0DF9 0DFA 0DFB 0DFC 0DFD 0DFF 0E00 0E01 0E02 0E03 0E04 0E05 0E06 (11 Replies)
Discussion started by: greycells
11 Replies

10. 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
SG_DECODE_SENSE(8)						     SG3_UTILS							SG_DECODE_SENSE(8)

NAME
sg_decode_sense - decode SCSI sense data SYNOPSIS
sg_decode_sense [--binary=FN] [--file=FN] [--help] [--hex] [--nospace] [--status=SS] [--verbose] [--version] [--write=WFN] [H1 H2 H3 ...] DESCRIPTION
This utility takes SCSI sense data in binary or as a sequence of ASCII hexadecimal bytes and decodes it. The primary reference for the decoding is SPC-3 ANSI INCITS 408-2005 and the most recent draft SPC-4 revision 29 which can be found at http://www.t10.org and other loca- tions on the internet. SCSI sense data is often found in kernel log files as a result of something going wrong but may just be informative. It is often shown as a sequence of hexadecimal bytes, starting with 70, 71, 72, 73, f0 or f1. Sense data could be up to 252 bytes long but typically is much shorter than that, 18 bytes long is often seen and is usually associated with the older "fixed" format sense data. The sense data can be provided on the command line or in a file. If given on the command line the sense data should be a sequence of hexa- decimal bytes separated by space. Alternatively a file can be given with the contents in binary or ASCII hexadecimal bytes. The latter form can contain several lines each with none, one or more ASCII hexadecimal bytes separated by space (comma or tab). The hash symbol may appear and it and the rest of the line is ignored making it useful for comments. OPTIONS
Arguments to long options are mandatory for short options as well. -b, --binary=FN the sense data is read in binary from a file called FN. -h, --help output the usage message then exit. -H, --hex this option is used in conjunction with --write=WFN in order to change the output written to WFN to lines of ASCII hex bytes suit- able for a C language compiler. Each line contains up to 16 bytes (e.g. a line starting with "0x3b,0x07,0x00,0xff"). -f, --file=FN the sense data is read in ASCII hexadecimal from a file called FN. The sense data should appear as a sequence of bytes separated by space, comma, tab or newline. Everything from and including a hash symbol to the end of that line is ignored. If --nospace is set then no separator is required between the ASCII hexadecimal digits in FN with bytes decoded from pairs of ASCII hexadecimal digits. -n, --nospace expect ASCII hexadecimal to be a string of hexadecimal digits with no spaces between them. Bytes are decoded by taking two hexadeci- mal digits at a time, so an even number of digits is expected. The string of hexadecimal digits may be on the command line (replac- ing "H1 H2 H3") or spread across multiple lines the FN given to --file=. -s, --status=SS where SS is a SCSI status byte value, given in hexadecimal. The SCSI status byte is related to but distinct from sense data. -v, --verbose increase the degree of verbosity (debug messages). -V, --version output version string then exit. -w, --write=WFN writes the sense data out to a file called WFN. If necessary WFN is created. If WFN exists then it is truncated prior to writing the sense data to it. If the --hex option is also given then ASCII hex is written to WFN (see the --hex option description); otherwise binary is written to WFN. This option is a convenience and may be helpful in converting the ASCII hexadecimal representation of sense data (or anything else) into the equivalent binary or a compilable ASCII hex form. NOTES
Unlike most utilities in this package, this utility does not access a SCSI device (logical unit). This utility accesses a library associ- ated with this package. Amongst other things the library decodes SCSI sense data. EXAMPLES
Sense data is often printed out in kernel logs and sometimes on the command line when verbose or debug flags are given. It will be at least 8 bytes long, often 18 bytes long but may be longer. A sense data string might look like this: f0 00 03 00 00 12 34 0a 00 00 00 00 11 00 00 00 00 00 Cut and paste it after the sg_decode_sense command: sg_decode_sense f0 00 03 00 00 12 34 0a 00 00 00 00 11 00 00 00 00 00 and for this sense data the output should look like this: Fixed format, current; Sense key: Medium Error Additional sense: Unrecovered read error Info fld=0x1234 [4660] For a medium error the Info field is the logical block address (LBA) of the lowest numbered block that the associated SCSI command was not able to read (verify or write). EXIT STATUS
The exit status of sg_decode_sense is 0 when it is successful. Otherwise see the sg3_utils(8) man page. AUTHORS
Written by Douglas Gilbert. REPORTING BUGS
Report bugs to <dgilbert at interlog dot com>. COPYRIGHT
Copyright (C) 2010-2011 Douglas Gilbert This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- POSE. SEE ALSO
sg_requests(sg3_utils) sg3_utils-1.32 March 2011 SG_DECODE_SENSE(8)
All times are GMT -4. The time now is 07:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy