![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| append zero's in the begining | ganapati | UNIX for Dummies Questions & Answers | 3 | 01-17-2008 09:41 AM |
| Adding a new HDD | jeffreydavisjr | UNIX for Dummies Questions & Answers | 5 | 10-16-2006 12:13 PM |
| adding licenses | andryk | SUN Solaris | 0 | 05-19-2004 07:26 AM |
| Adding 2 numbers | Viper01 | Shell Programming and Scripting | 7 | 04-17-2004 09:59 AM |
| Leading Zero's | dbrundrett | Shell Programming and Scripting | 5 | 12-19-2003 06:15 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
adding zero's
Hi
I am comparing two files, 100th column have formatting issue i mean 1 file have scale 4 and anothe file scale 2 ,if scale 2 need to add two zeros.Please any idea how to add two zers to 100th coulmn if scale is 2 file 1 .................1234.2000 file2 ................1234.20 Thanks, MR |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
> x1=1234.20 > echo $x1 1234.20 > echo $(printf "%.4f" "$x1") 1234.2000 Code:
> x2=1234.2000 > x3=$(echo "$x1"-"$x2" | bc) > echo $x3 0 |
|
#3
|
|||
|
|||
|
Hi
Thanks for your reply .when comparing two files this 100th filed giving differences due to formatting issue .Is there any way to achive using sed or awk Thanks in advance MR |
|
#4
|
|||
|
|||
|
Force awk to compare the string numerically...
Code:
echo 1234.2000 | awk '{print $0+0}'
1234.2
echo 1234.20 | awk '{print $0+0}'
1234.2
|
|||
| Google The UNIX and Linux Forums |