Sponsored Content
Top Forums Shell Programming and Scripting Convert exponential value to decimal Post 302336746 by Sangtha on Wednesday 22nd of July 2009 05:35:30 PM
Old 07-22-2009
Convert exponential value to decimal

Hi,

Here is my script to read a file into array:
awk -F '[ \t$]+' '
# load first file into array indexed by fields 1 and 2
NR == FNR {
file1nr = FNR
for (i=3; i<NF; i++) {
file1[$1,$2,i] = $i
}


I have this value in file -1191190.11328125, but my script reads it as -1191190.00000
I want to read it as -1191190.11328.

I tried to add a line

$i = sprintf ("%.5d" $i)

But this yields -1191190.00000

Please help.

I tried
I want to read it upto 5 decimal places.

Please help.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Convert hexadecimal to decimal base

Hello ! Does anyone knows how can I convert hexadecimal to decimal base in the ksh or csh script ?? Thanks ! Witt (1 Reply)
Discussion started by: witt
1 Replies

2. Shell Programming and Scripting

Convert hex to decimal or reverse is better?

Please Help Me! about the problem down under. I have 2 files with nearly the same characteristics, I have to convert one to the other format or the other format to one's format. I want to write it with awk. The first file contain lines like this: 300000001#A#Y#Y#Y#Y The other file contain... (4 Replies)
Discussion started by: Axel82
4 Replies

3. Shell Programming and Scripting

Convertion from Exponential to Decimal

I am trying to read values from excel and perform some calculations but I am getting below error: expr 2.326227180240883E7 / 8.509366417956961E8 expr: non-numeric argument Can anyone let me know how do i convert thse exponential numbers to decimal. (2 Replies)
Discussion started by: sachinnayyar
2 Replies

4. Shell Programming and Scripting

Convert hex to decimal

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)
Discussion started by: Arun_Linux
2 Replies

5. Shell Programming and Scripting

[Solved] need to convert decimal to integer

Using below command awk 'NR==FNR{A=$1;next} {sum+=($2*A)}END{OFMT="%20f";print int(sum)}' Market.txt Product.txt answer:351770174.00000 how to convert this to 351770174. when i try with below command i am getting different result. awk 'NR==FNR{A=$1;next}... (3 Replies)
Discussion started by: katakamvivek
3 Replies

6. Shell Programming and Scripting

Convert hexadecimal value in decimal value

hi all, this is my script: #! /bin/sh minutes=$( { i2cget -f -y 0 0x51 3; } 2>&1 ) minutes=${minutes:2} hour=$( { i2cget -f -y 0 0x51 4; } 2>&1 ) hour=${hour:2} day=$( { i2cget -f -y 0 0x51 5; } 2>&1 ) day=${day:2} month=$( { i2cget -f -y 0 0x51 7; } 2>&1 ) month=${month:2} ... (6 Replies)
Discussion started by: enaud
6 Replies

7. UNIX for Dummies Questions & Answers

Convert hexa decimal to decimal

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)
Discussion started by: sudhakar T
4 Replies

8. Programming

Urgent help needed.. C++ program to convert decimal to hexa decimal

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)
Discussion started by: greenworld123
1 Replies

9. UNIX for Dummies Questions & Answers

Convert hexadecimal value to decimal value

Hi All, cat filename | awk '{print $1, $2, $4, $5, $6, $7, $8, $9, $10;}' | awk 'NF > 0' OUTPUT: 2015-01-19 00:12:32 00000000fbfa0000 000000009ae5cf80 014d 015d 0017 003c 0362de20 2015-01-19 00:13:52 00000000fc820000 00000000994c6758 014c 015d 000b 003c 08670250 2015-01-19 00:14:25... (12 Replies)
Discussion started by: sam@sam
12 Replies

10. UNIX for Advanced & Expert Users

Convert a numeric to 2 decimal point value

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
GLBINDBUFFERRANGE(3G)						    OpenGL 3.3						     GLBINDBUFFERRANGE(3G)

NAME
glBindBufferRange - bind a range within a buffer object to an indexed buffer target C SPECIFICATION
void glBindBufferRange(GLenumtarget, GLuintindex, GLuintbuffer, GLintptroffset, GLsizeiptrsize); PARAMETERS
target Specify the target of the bind operation. target must be either GL_TRANSFORM_FEEDBACK_BUFFER or GL_UNIFORM_BUFFER. index Specify the index of the binding point within the array specified by target. buffer The name of a buffer object to bind to the specified binding point. offset The starting offset in basic machine units into the buffer object buffer. size The amount of data in machine units that can be read from the buffet object while used as an indexed target. DESCRIPTION
glBindBufferRange binds a range the buffer object buffer represented by offset and size to the binding point at index index of the array of targets specified by target. Each target represents an indexed array of buffer binding points, as well as a single general binding point that can be used by other buffer manipulation functions such as glBindBuffer() or glMapBuffer(). In addition to binding a range of buffer to the indexed buffer binding target, glBindBufferBase also binds the range to the generic buffer binding point specified by target. offset specifies the offset in basic machine units into the buffer object buffer and size specifies the amount of data that can be read from the buffer object while used as an indexed target. ERRORS
GL_INVALID_ENUM is generated if target is not GL_TRANSFORM_FEEDBACK_BUFFER or GL_UNIFORM_BUFFER. GL_INVALID_VALUE is generated if index is greater than or equal to the number of target-specific indexed binding points. GL_INVALID_VALUE is generated if size is less than or equal to zero, or if offset + size is greater than the value of GL_BUFFER_SIZE. Additional errors may be generated if offset violates any target-specific alignmemt restrictions. SEE ALSO
glGenBuffers(), glDeleteBuffers(), glBindBuffer(), glBindBufferBase(), glMapBuffer(), glUnmapBuffer(), COPYRIGHT
Copyright (C) 2010 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/. OpenGL 3.3 03/08/2011 GLBINDBUFFERRANGE(3G)
All times are GMT -4. The time now is 10:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy