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
After converting the hexstr to Hex and storing the Hex in a char* rvan High Level Programming 1 08-09-2009 11:18 PM
Adding a single char to a char pointer. pallak7 High Level Programming 5 12-06-2008 11:46 PM
How to replace any char with newline char. mightysam Shell Programming and Scripting 5 09-18-2008 09:15 PM
Perl code to differentiate numeric and non-numeric input Raynon Shell Programming and Scripting 11 08-04-2007 11:32 AM
How to check a column contain numeric or char data type ?? jambesh Shell Programming and Scripting 12 10-06-2006 11:37 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 10-02-2009
dear_abhi2007 dear_abhi2007 is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 8
Converting Char to Numeric

HI,
Here I have the following output and want to do some mathematical calculation on C2 & C3 column.

Code:
  
         c1         c2                 c3          c4          c5
l1      1-oct     12:30:01      12:35        abc        xyz
l2      1-oct     14:20:01      14:35        def        pqr
l3      2-oct     23:50:01      00:05        ghi        mno



O/p I need as two column inserted in-between the above o/p. i have 50 records like this.
C1 C2 C3 C3-C2 C3(l2) - C3(l1) C4 C5



But when I use SET command it is treating the values as character & I am not able to do any operation.
echo `expr $3 - $2`
expr: non-numeric argument

So do we have any other command which can help me in this process or any cmd by which I can convert it to numeric value.

Last edited by jim mcnamara; 10-02-2009 at 07:11 AM.. Reason: code tags
 

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:52 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