Sponsored Content
Full Discussion: Computation Problem
Top Forums Shell Programming and Scripting Computation Problem Post 302073297 by PradeepRed on Thursday 11th of May 2006 04:17:32 PM
Old 05-11-2006
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
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem with dd command or maybe AFS problem

Hi, folks. Sorry for bothering, but maybe someone could help me please. The problem is the following: there is some script that copies files from local file system to AFS. The copying is performed with dd command. The script copies data into some AFS volumes. The problem appeared with one... (0 Replies)
Discussion started by: Anta
0 Replies

2. Shell Programming and Scripting

ssh script problem problem

Hi Please help me with the following problem with my script. The following block of code is not repeating in the while loop and exiting after searching for first message. input_file ========== host001-01 host001-02 2008-07-23 13:02:04,651 ConnectionFactory - Setting session state... (2 Replies)
Discussion started by: pcjandyala
2 Replies

3. AIX

user login problem & Files listing problem.

1) when user login to the server the session got colosed. How will resolve? 2) While firing the command ls -l we are not able to see the any files in the director. but over all view the file system using the command df -g it is showing 91% used. what will be the problem? Thanks in advance. (1 Reply)
Discussion started by: pernasivam
1 Replies

4. AIX

How to create a filesystem with the correct computation of PP

Hi everyone, im having a problem with the computation of the PP size for creating a filesystem. for example my requirement is to create a new filesystem with 10gig of system on aix 5.1 and aix 5.3 system. here's the result when i run lsvg vgSAN-sparkle could any provide me an exact... (3 Replies)
Discussion started by: cwiggler
3 Replies

5. Programming

computation migration

Hi, i need a code to implement computation migration in c. Can you guys help me out?? (3 Replies)
Discussion started by: tanvi
3 Replies

6. IP Networking

Problem with forwarding emails (SPF problem)

Hi, This is rather a question from a "user" than from a sys admin, but I think this forum is apropriate for the question. I have an adress with automatic email forwarding and for some senders (two hietherto), emails are bouncing. This has really created a lot of problems those two time so I... (0 Replies)
Discussion started by: carwe
0 Replies

7. AIX

AIX DateTime Computation

Good day people, Kindly advice on below please. 1) Formatting/ Arithmetic operation of given date I understand from the AIX man date and some research that flag -d is not applicable for AIX shell scripting and some of the UNIX command date command is not available in AIX. Please advice... (1 Reply)
Discussion started by: cielle
1 Replies

8. UNIX for Dummies Questions & Answers

sed Or Grep Problem OR Terminal Problem?

I don't know if you guys get this problem sometimes at Terminal but I had been having this problem since yesterday :( Maybe I overdid the Terminal. Even the codes that used to work doesn't work anymore. Here is what 's happening: * I wanted to remove lines containing digits so I used this... (25 Replies)
Discussion started by: Nexeu
25 Replies
SMDIAG(8)						     Linux Programmer's Manual							 SMDIAG(8)

NAME
smdiag - Linux soundcard packet radio modem driver diagnostics utility SYNOPSIS
smdiag [-i device] [-d display] [ -ce ] DESCRIPTION
smdiag may help to adjust the audio levels of the soundcard modem driver, as well as to control the quality of the radio link. It may either display an oscilloscope like view of the input signal, or display an eye diagram. The display may be gated with DCD, i.e. only updated if the modem detects a data carrier. OPTIONS
smdiag accepts the following options: -i The device argument specifies the soundcard modem device which should be configured or interrogated. It will usually have the fol- lowing form: sm[0-3]. -d sets the address of the X server to display the window. -h display an overview of the available command line parameters and exit. -c toggle the carrier gating of the display. -e display an eye diagram (overlay of the synchronized demodulator output) instead of an oscilloscope view of the input signal. KEYS
C clears the window D toggles the DCD gating. E displays an eye diagram I displays the input signal Q quits smdiag BUGS
smdiag Reacts sluggishly to keypresses. The window size is fixed. For speed reasons, two square root operations per sample are not imple- mented in the AFSK 1200 baud modes. The eye diagram for the AFSK 1200 baud mode is therefore distorted. SEE ALSO
smmixer (8), sethdlc (8), linux/drivers/net/soundmodem.c AUTHOR
smdiag was written by Thomas Sailer (t.sailer@alumni.ethz.ch). Smdiag 0.1 1 October 1996 SMDIAG(8)
All times are GMT -4. The time now is 09:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy