![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| problem with dd command or maybe AFS problem | Anta | Shell Programming and Scripting | 0 | 08-25-2006 11:10 AM |
| SSH Problem auth problem | budrito | UNIX for Advanced & Expert Users | 1 | 03-17-2004 10:12 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Computation Problem
Hi Folks I have a file with the following sample input 919416586748,1200,31200 919416283619,3521,33521 919416811900,2440,64940 919416576012,13670,43670 Now i want to subtract the second value (where , is field separator) from the third value and display the output as follows 919416,30000 919416,30000 919416,62500 919416,30000 i wrote a simple program Code:
for var in `cat 1` do a1=`echo $var | cut -d"," -f1|cut -c1-6` a2=`echo $var | cut -d"," -f2` a3=`echo $var | cut -d"," -f3` a4=`expr $a3 - $a2` echo "$a1,$a4" >> 2 done This works fine for files which are of small size. But my input file has over 1 million entries and hence is taking a damn long time to process. Can anybody recommend a much faster method for the same? Thanks in advance Regards |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|