For dealing with columns, use a tool that understands columns, like awk, so you can do a straightforward 'check if this exact column matches this exact string' comparison, instead of weird convolutions with sed to try and force a stream tool to do operations on columns.
Hi,
Here is my script to read a file into array:
awk -F '+' '
# load first file into array indexed by fields 1 and 2
NR == FNR {
file1nr = FNR
for (i=3; i<NF; i++) {
file1 = $i
}
I have this... (5 Replies)
can someone help me in converting hex streams to decimal values using perl script
Hex value:
$my_hex_stream="0c07ac14001676";
Every hex value in the above stream should be converted in to decimal and separated by comma.
The output should be: 12,07,172,20,00,22,118 (2 Replies)
Hi,
I want to convert two hexadecimal numbers to decimal using unix command line.
1cce446295197a9d6352f9f223a9b698
fc8f99ac06e88c4faf669cf366f60d
I tried using
`echo "ibase=16; $no |bc`
printf '%x\n' "1cce446295197a9d6352f9f223a9b698"
but it doesn't work for such big number it... (4 Replies)
Hello
I have a file of the form
...
num 0.12 num num
num 25.53 num num
num 7.82 num num
......
and I want to convert the 2nd field of each line adding a "0" at the numbers >= 0 and < 10 so the output will have the form:
...
num 00.12 num num
num 25.53 num num
num 07.82 num... (10 Replies)
Hi ,
seq can be 0...128
int windex = seq / 8;
int bindex = seq % 8;
unsigned char bitvalue = '\x01' << (7-bindex) ;
bpv.bitmapvalue = bitvalue;
This is the part of a program to convert decimal to bitmap value of hexadecimal.
I want this to change to convert only to... (1 Reply)
Hi,
I have been stuck in this requirement where my file contains the below format.
20150812170500846959990854-25383-8.0.0
"ABC Report" hp96880
"4952"
20150812170501846959990854-25383-8.0.0 End of run
20150812060132846959990854-20495-8.0.0
"XYZ Report" vg76452
"1006962188"... (6 Replies)
Hi , I have a file which contains text like
A|Mau|Code|12|Detail
B|Mau|Code|20|Header
I want to write a command using awk which will output
A|Mau|Code|12.00|Detail
B|Mau|Code|20.00|Header
I used a command like awk -F"|" {printf "%s|%s|%s|%.2f|%s",$1,$2,$3,$4,$5}' which does the... (4 Replies)
Discussion started by: LoneRanger
4 Replies
LEARN ABOUT ULTRIX
xrmquarktostring
XrmUniqueQuark(3X11) MIT X11R4 XrmUniqueQuark(3X11)Name
XrmUniqueQuark, XrmStringToQuark, XrmQuarkToString, XrmStringToQuarkList, XrmStringToBindingQuarkList - manipulate resource quarks
Syntax
XrmQuark XrmUniqueQuark()
#define XrmStringToName(string) XrmStringToQuark(string) #define XrmStringToClass(string) XrmStringToQuark(string) #define XrmStringToRep-
resentation(string) XrmStringToQuark(string)
XrmQuark XrmStringToQuark(string)
char *string;
#define XrmNameToString(name) XrmQuarkToString(name) #define XrmClassToString(class) XrmQuarkToString(class) #define XrmRepresentation-
ToString(type) XrmQuarkToString(type)
char *XrmQuarkToString(quark)
XrmQuark quark;
#define XrmStringToNameList(str, name) XrmStringToQuarkList((str), (name)) #define XrmStringToClassList(str,class) XrmStringToQuark-
List((str), (class))
void XrmStringToQuarkList(string, quarks_return)
char *string;
XrmQuarkList quarks_return;
XrmStringToBindingQuarkList(string, bindings_return, quarks_return)
char *string;
XrmBindingList bindings_return;
XrmQuarkList quarks_return;
Arguments
bindings_return
Returns the binding list.
quark Specifies the quark for which the equivalent string is desired.
quarks_return
Returns the list of quarks.
string Specifies the string for which a quark is to be allocated.
Description
The function allocates a quark that is guaranteed not to represent any string that is known to the resource manager.
These functions can be used to convert to and from quark representations. The string pointed to by the return value must not be modified
or freed. If no string exists for that quark, returns NULL.
The function converts the specified resource quark representation back to a string.
The function converts the null-terminated string (generally a fully qualified name) to a list of quarks. Note that the string must be in
the valid ResourceName format. The components of the string are separated by a period or asterisk character.
A binding list is a list of type and indicates if components of name or class lists are bound tightly or loosely (that is, if wildcarding
of intermediate components is specified).
typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding,
*XrmBindingList;
indicates that a period separates the components, and indicates that an asterisk separates the components.
The function converts the specified string to a binding list and a quark list. Component names in the list are separated by a period or an
asterisk character. If the string does not start with period or asterisk, a period is assumed. For example, ``*a.b*c'' becomes:
quarks a b c
bindings loose tightloose
See AlsoXrmGetResource(3X11), XrmInitialize(3X11), XrmMergeDatabases(3X11), XrmPutResource(3X11)
X Window System: The Complete Reference, Second Edition, Robert W. Scheifler and James Gettys
XrmUniqueQuark(3X11)