The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Linux Shell Question: how to print the shell script name ? meili100 UNIX for Dummies Questions & Answers 3 07-01-2008 02:55 PM
Shell script question jbou1087 Shell Programming and Scripting 2 05-06-2008 03:01 AM
A shell script question surjyap Shell Programming and Scripting 2 11-24-2005 05:48 AM
Simply shell script question frustrated1 Shell Programming and Scripting 8 07-03-2005 03:22 AM
BASH shell script question ewarmour Shell Programming and Scripting 3 05-24-2002 06:10 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-28-2007
tselvanin tselvanin is offline
Registered User
  
 

Join Date: Sep 2003
Posts: 10
shell script question

I am using ksh.

There is a report having amounts in the following format,

34343.67-
2343.45
23434.89-

I want to sum up all the amounts. For this I first need to find out if there is a minus sign at the end and prefix it before summing up. How to achieve this?

I thought of using an array to store the values and then sum up the amounts using a while loop. But don't have any clue as how to first convert the amounts to below format,

-34343.67
2343.45
-23434.89

Any help is appreciated.
Thanks!
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0