Sponsored Content
Top Forums UNIX for Advanced & Expert Users Convert a numeric to 2 decimal point value Post 303025712 by RudiC on Saturday 10th of November 2018 08:02:32 AM
Old 11-10-2018
awk works on pattern {action} pairs in a way that it evaluates the pattern, and, if TRUE, executes the action.

man awk:
Quote:
One, but not both, of pattern {action} can be omitted. If {action} is omitted it is implicitly { print }. If pattern is omitted, then it is implicitly matched.

So - as 1 represents TRUE, awk executes the default action print.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Floating point numeric comparisions in bash

Hi, I am trying to compare 2 floating point numbers 0.8 and 0.15 using bash and get the largest of the two. Can anyone advise. (2 Replies)
Discussion started by: borncrazy
2 Replies

2. Shell Programming and Scripting

how to get rid of decimal point?

Hi, I have input with decimal point ( 9.99 ) for hours variable hrs. I need to change it to seconds. Here is my code: secs=`/usr/ucb/echo $hrs*3600 |bc` But I don't want to see the decimal point. I can use awk to trim it if there is one. I am just wondering if there is better standard... (2 Replies)
Discussion started by: cin2000
2 Replies

3. Shell Programming and Scripting

Insert a decimal point

Hi all. Using /bin/sh on an HPUX system. I want to place a decimal in the field 2 charactors from the right (yes, converting to currency). The field lengths are variable. Here's what I'm doing: exec < filename while read FIELD1 FIELD2 do FIELD1="echo $FIELD1 | sed 'syntax that will... (4 Replies)
Discussion started by: lyoncc
4 Replies

4. Shell Programming and Scripting

PERL:How to convert numeric values txt file to PACKED DECIMAL File?

Is there any way to convert numeric values txt file to PACKED DECIMAL File using PERL. Regards, Alok (1 Reply)
Discussion started by: aloktiwary
1 Replies

5. Shell Programming and Scripting

Comparing two numbers with decimal point

How to compare two numbers with decimal points ? Is there a way in bash to do this? (33 Replies)
Discussion started by: kinny
33 Replies

6. Shell Programming and Scripting

Convert decimal notation to ANSI point code notation

wondering if anyone has any thoughts to convert the below thru a shell script Convert decimal signalling point notation to ANSI point code notation There is a site that does that conversion but i need to implement the solution in a shell script.....Thoughts.... OS: Solaris 9 ... (4 Replies)
Discussion started by: aavam
4 Replies

7. Shell Programming and Scripting

Retain upto 2 decimal point for numeric values

Hi I have a big file with lines like below <tr align="center" bgcolor="SEASHELL"><td>94% </td><td>4.62178 </td><td>73.4375 </td></tr> <tr align="center" bgcolor="SEASHELL"></td><td>97% </td><td>3.2962 </td><td>125 </td></tr> I want to format the file such that i get like below. i.e... (3 Replies)
Discussion started by: ningy
3 Replies

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

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

10. UNIX for Beginners Questions & Answers

How to add following decimal point to a CSV value?

hi there I being trying to figure out way to add " .0" to an integer value in a csv using sed or awk with out success. just as a work around for 2147483647 32 bit limitation that influxdb is currently having the data base will accept values and work fine if it has the XXX.0 ... (7 Replies)
Discussion started by: sash99
7 Replies
putws(3C)						   Standard C Library Functions 						 putws(3C)

NAME
putws - convert a string of Process Code characters to EUC characters SYNOPSIS
#include <stdio.h> #include <widec.h> int putws(wchar_t *s); DESCRIPTION
The putws() function converts the Process Code string (terminated by a (wchar_t)NULL) pointed to by s, to an Extended Unix Code (EUC) string followed by a NEWLINE character, and writes it to the standard output stream stdout. It does not write the terminal null character. RETURN VALUES
The putws() function returns the number of Process Code characters transformed and written. It returns EOF if it attempts to write to a file that has not been opened for writing. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
ferror(3C), fopen(3C), fread(3C), getws(3C), printf(3C), putwc(3C), attributes(5) SunOS 5.10 22 Apr 1997 putws(3C)
All times are GMT -4. The time now is 08:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy