Search Results

Search: Posts Made By: Noobie1995
2,259
Posted By anbu23
Add zero $ printf "%+010.2f" "-23.435456" ...
Add zero
$ printf "%+010.2f" "-23.435456"
-000023.44
2,259
Posted By devtakh
Try using print command with the right format. ...
Try using print command with the right format.

$ echo $a
-000023.44
$ printf "%2.8f" $a
-23.44000000


cheers,
Devaraj Takhellambam
2,259
Posted By anbu23
Add plus to Devaraj's solution to get plus sign...
Add plus to Devaraj's solution to get plus sign before positive numbers
$ a=9
$ printf "%+2.8f" $a
+9.00000000
$ a=-9.999
$ printf "%+2.8f" $a
-9.99900000
Forum: War Stories 03-02-2013
5,896
Posted By Don Cragun
I have no idea what you're trying to do and the...
I have no idea what you're trying to do and the variable names don't make any sense to me, but the following is a reformatted, simplified version of your script that is a valid bash script (and is...
1,861
Posted By MadeInGermany
And the same rule applies here: value=$(printf...
And the same rule applies here:
value=$(printf "%-$3s" "$2")value= is an assignment, no need for quotes.
$2 is an argument (of the printf command), to be quoted.

---------- Post updated at 12:37...
1,861
Posted By Scrutinizer
Try: vorg_nr=$value echo "$vorg_nr" You...
Try:
vorg_nr=$value
echo "$vorg_nr"

You do not need the double quotes with the assignment, but you do need them with the echo statement, otherwise the content of the variable will be interpreted...
1,861
Posted By Scrutinizer
Hi, try: echo "$value"
Hi, try:
echo "$value"
Showing results 1 to 7 of 7

 
All times are GMT -4. The time now is 11:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy