Sponsored Content
Top Forums Shell Programming and Scripting Percentage Calculation in Decimal Post 302731065 by Anupam_Halder on Wednesday 14th of November 2012 07:05:57 AM
Old 11-14-2012
not working Smilie

Code:
[[XXXXXXXXXXXXXXXXX]:~ 07:01:55 $]b=47
[[XXXXXXXXXXXXXXXXX]:~ 07:02:09 $]a=7
[[XXXXXXXXXXXXXXXXX]:~ 07:02:16 $]printf "%.2f\n" $(((b-a)/b*100))
0.00
[[XXXXXXXXXXXXXXXXX]:~ 07:02:20 $]printf "%.2f\n" $(((b-a)*100/b))
85.00
[[XXXXXXXXXXXXXXXXX]:~ 07:02:37 $]printf "%.2f\n" $(echo "scale=2\n(($b-$a)*100)/$b"|bc)
(standard_in) 1: illegal character: \
(standard_in) 1: parse error
0.00



Please help.
1st one not giving decimal output and 2nd one not working.

Last edited by Scott; 11-14-2012 at 08:49 AM.. Reason: Code tags
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

decimal calculation

Hi am calculating the percentage of the pass and fail. Pass: echo `echo 1498*100/1667| bc`% fail: echo `echo 169*100/1667 | bc`% for this am getting PASS= 89% fail =10 % I need to fetch the exact decimal percentage like PASS = 89.8 % FAIL= 10.2 % Please advice me (3 Replies)
Discussion started by: bobprabhu
3 Replies

2. Shell Programming and Scripting

awk/sed percentage calculation

Hi all i have a text file with columns delimited with , 2010-08-18,10,24,.09751,39,7,14872,26732 . . . i would to add a extra column in the end with percentage calculation of columns 5 and 8 ie (39/26732)*100 so the output must look like ... (6 Replies)
Discussion started by: posner
6 Replies

3. UNIX for Dummies Questions & Answers

Decimal to BCD (Binary Coded Decimal)

Anybody please help me... Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary Coded Decimal) representation. Also, draw its Flow Chart. This is a unix qn... plz post algorithm for that :confused: (1 Reply)
Discussion started by: caramba
1 Replies

4. Homework & Coursework Questions

Decimal to BCD (Binary Coded Decimal)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary... (2 Replies)
Discussion started by: caramba
2 Replies

5. Shell Programming and Scripting

Decimal number calculation problem

I have a below snippet of code from my perl script and its causing a problem when the output of $lTAX is 0 (zero) its getting displayed as -0.00. I want output to be 0 not -0.00. Any help would be appreciated. #!/usr/bin/perl my $lTotA = 50.94; my $lVatA = 8.49; my $lAllocD; my $lAdjNr =... (4 Replies)
Discussion started by: Devesh5683
4 Replies

6. Shell Programming and Scripting

Percentage calculation

i am trying to get percentage : but not able to do it: i tried : x=1 y=2 z=`expr $x/$y*100` it is not giving me result can u pls help on this (4 Replies)
Discussion started by: Aditya.Gurgaon
4 Replies

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

8. Shell Programming and Scripting

Percentage calculation

Hi, I have a text file in below format. I trying to find a solution for finding percentage used for each of the NAMEs. Directory ALLOCATED USED NAME1 93MB 93KB NAME2 25G 62K NAME3 14G 873M NAME4 25G 62K NAME5 20G... (10 Replies)
Discussion started by: ctrld
10 Replies

9. Shell Programming and Scripting

Help with awk percentage calculation from a file

i have a file say test with the below mentioned details Folder Name Total space Space used /test/test1 500.1GB 112.0 GB /test/test2 3.2 TB 5TB /test/test3 3TB 100GB i need to calculate percentage of each row based on total space and space used and copy... (9 Replies)
Discussion started by: venkitesh
9 Replies
DateTime::Locale::lo(3) 				User Contributed Perl Documentation				   DateTime::Locale::lo(3)

NAME
DateTime::Locale::lo SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'lo' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Lao. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) XXXXXX XXXXXXXXX XXXXXX XXXXXXXX XXXXXX XXXXXXX XXXXXXXX Abbreviated (format) X. X. X. XX. XX. X. XX. Narrow (format) 2 3 4 5 6 7 1 Wide (stand-alone) XXXXXX XXXXXXXXX XXXXXX XXXXXXXX XXXXXX XXXXXXX XXXXXXXX Abbreviated (stand-alone) X. X. X. XX. XX. X. XX. Narrow (stand-alone) 2 3 4 5 6 7 1 Months Wide (format) XXXXXX XXXXX XXXX XXXX XXXXXXX XXXXXX XXXXXXX XXXXX XXXXX XXXX XXXXX XXXXX Abbreviated (format) X.X. X.X. XX.X. X.X.. X.X. XX.X. X.X. X.X. X.X. X.X. X.X. X.X. Narrow (format) 1 2 3 4 5 6 7 8 9 10 11 12 Wide (stand-alone) XXXXXX XXXXX XXXX XXXX XXXXXXX XXXXXX XXXXXXX XXXXX XXXXX XXXX XXXXX XXXXX Abbreviated (stand-alone) X.X. X.X. XX.X. X.X.. X.X. XX.X. X.X. X.X. X.X. X.X. X.X. X.X. Narrow (stand-alone) 1 2 3 4 5 6 7 8 9 10 11 12 Quarters Wide (format) Q1 Q2 Q3 Q4 Abbreviated (format) Q1 Q2 Q3 Q4 Narrow (format) 1 2 3 4 Wide (stand-alone) Q1 Q2 Q3 Q4 Abbreviated (stand-alone) Q1 Q2 Q3 Q4 Narrow (stand-alone) 1 2 3 4 Eras Wide BCE CE Abbreviated XXXXXXXXXXXXXXXXX X.X. Narrow XXXXXXXXXXXXXXXXX X.X. Date Formats Full 2008-02-05T18:30:30 = XXXXXXXXXXX 5 XXXXX X.X. 2008 1995-12-22T09:05:02 = XXXXXXXX 22 XXXXX X.X. 1995 -0010-09-15T04:44:23 = XXXXXXXXX 15 XXXXX XXXXXXXXXXXXXXXXX -10 Long 2008-02-05T18:30:30 = 5 XXXXX 2008 1995-12-22T09:05:02 = 22 XXXXX 1995 -0010-09-15T04:44:23 = 15 XXXXX -10 Medium 2008-02-05T18:30:30 = 5 X.X. 2008 1995-12-22T09:05:02 = 22 X.X. 1995 -0010-09-15T04:44:23 = 15 X.X. -10 Short 2008-02-05T18:30:30 = 5/2/2008 1995-12-22T09:05:02 = 22/12/1995 -0010-09-15T04:44:23 = 15/9/-010 Default 2008-02-05T18:30:30 = 5 X.X. 2008 1995-12-22T09:05:02 = 22 X.X. 1995 -0010-09-15T04:44:23 = 15 X.X. -10 Time Formats Full 2008-02-05T18:30:30 = 18XXX 30XXXX 30 XXXXXXUTC 1995-12-22T09:05:02 = 9XXX 5XXXX 02 XXXXXXUTC -0010-09-15T04:44:23 = 4XXX 44XXXX 23 XXXXXXUTC Long 2008-02-05T18:30:30 = 18 XXX 30XXXX30 UTC 1995-12-22T09:05:02 = 9 XXX 5XXXX02 UTC -0010-09-15T04:44:23 = 4 XXX 44XXXX23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 Datetime Formats Full 2008-02-05T18:30:30 = XXXXXXXXXXX 5 XXXXX X.X. 2008, 18XXX 30XXXX 30 XXXXXXUTC 1995-12-22T09:05:02 = XXXXXXXX 22 XXXXX X.X. 1995, 9XXX 5XXXX 02 XXXXXXUTC -0010-09-15T04:44:23 = XXXXXXXXX 15 XXXXX XXXXXXXXXXXXXXXXX -10, 4XXX 44XXXX 23 XXXXXXUTC Long 2008-02-05T18:30:30 = 5 XXXXX 2008, 18 XXX 30XXXX30 UTC 1995-12-22T09:05:02 = 22 XXXXX 1995, 9 XXX 5XXXX02 UTC -0010-09-15T04:44:23 = 15 XXXXX -10, 4 XXX 44XXXX23 UTC Medium 2008-02-05T18:30:30 = 5 X.X. 2008, 18:30:30 1995-12-22T09:05:02 = 22 X.X. 1995, 9:05:02 -0010-09-15T04:44:23 = 15 X.X. -10, 4:44:23 Short 2008-02-05T18:30:30 = 5/2/2008, 18:30 1995-12-22T09:05:02 = 22/12/1995, 9:05 -0010-09-15T04:44:23 = 15/9/-010, 4:44 Default 2008-02-05T18:30:30 = 5 X.X. 2008, 18:30:30 1995-12-22T09:05:02 = 22 X.X. 1995, 9:05:02 -0010-09-15T04:44:23 = 15 X.X. -10, 4:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 X. 1995-12-22T09:05:02 = 22 XX. -0010-09-15T04:44:23 = 15 X. Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 XXXXXXXX 1995-12-22T09:05:02 = 9:05 XXXXXXXX -0010-09-15T04:44:23 = 4:44 XXXXXXXX Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 XXXXXXXX 1995-12-22T09:05:02 = 9:05:02 XXXXXXXX -0010-09-15T04:44:23 = 4:44:23 XXXXXXXX M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (d/M) 2008-02-05T18:30:30 = 5/2 1995-12-22T09:05:02 = 22/12 -0010-09-15T04:44:23 = 15/9 MEd (E, M-d) 2008-02-05T18:30:30 = X., 2-5 1995-12-22T09:05:02 = XX., 12-22 -0010-09-15T04:44:23 = X., 9-15 MMM (LLL) 2008-02-05T18:30:30 = X.X. 1995-12-22T09:05:02 = X.X. -0010-09-15T04:44:23 = X.X. MMMd (MMM d) 2008-02-05T18:30:30 = X.X. 5 1995-12-22T09:05:02 = X.X. 22 -0010-09-15T04:44:23 = X.X. 15 MMMEd (E MMM d) 2008-02-05T18:30:30 = X. X.X. 5 1995-12-22T09:05:02 = XX. X.X. 22 -0010-09-15T04:44:23 = X. X.X. 15 MMMMd (d MMMM) 2008-02-05T18:30:30 = 5 XXXXX 1995-12-22T09:05:02 = 22 XXXXX -0010-09-15T04:44:23 = 15 XXXXX MMMMEd (E MMMM d) 2008-02-05T18:30:30 = X. XXXXX 5 1995-12-22T09:05:02 = XX. XXXXX 22 -0010-09-15T04:44:23 = X. XXXXX 15 mmss (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (y-M) 2008-02-05T18:30:30 = 2008-2 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -10-9 yMEd (EEE, y-M-d) 2008-02-05T18:30:30 = X., 2008-2-5 1995-12-22T09:05:02 = XX., 1995-12-22 -0010-09-15T04:44:23 = X., -10-9-15 yMMM (y MMM) 2008-02-05T18:30:30 = 2008 X.X. 1995-12-22T09:05:02 = 1995 X.X. -0010-09-15T04:44:23 = -10 X.X. yMMMEd (EEE, y MMM d) 2008-02-05T18:30:30 = X., 2008 X.X. 5 1995-12-22T09:05:02 = XX., 1995 X.X. 22 -0010-09-15T04:44:23 = X., -10 X.X. 15 yMMMM (y MMMM) 2008-02-05T18:30:30 = 2008 XXXXX 1995-12-22T09:05:02 = 1995 XXXXX -0010-09-15T04:44:23 = -10 XXXXX yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 Q1 1995-12-22T09:05:02 = 1995 Q4 -0010-09-15T04:44:23 = -10 Q3 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyM (M/yyyy) 2008-02-05T18:30:30 = 2/2008 1995-12-22T09:05:02 = 12/1995 -0010-09-15T04:44:23 = 9/-010 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = XXXXX 2008 1995-12-22T09:05:02 = XXXXX 1995 -0010-09-15T04:44:23 = XXXXX -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week XXXXXX SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::lo(3)
All times are GMT -4. The time now is 06:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy