LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-25-2009, 02:05 AM   #1
scub@
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
Bash for loop and arithmatic


Hi!

I am running the following bash script:

#!/bin/bash


for i in $(grep "Query time" qt.txt | awk '{print $12}');
do
echo $i

done

and I am getting results on query times, eg 3, 5, 4, 2 etc.

How can I now add up these results as well as get a count of the number of results?

please help the newbie!
 
Old 11-25-2009, 02:27 AM   #2
geek745
Member
 
Registered: Jul 2004
Location: Alton, IL
Distribution: Linux Mint; Slackware; Ubuntu; Slax
Posts: 172
Blog Entries: 2

Rep: Reputation: 34
What is a query time? Is this a homework problem? We generally do not do your homework for you here on LQ. Please post your system problem if you want a useful response.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to loop over text file lines within bash script for loop? johnpaulodonnell Linux - Newbie 9 07-28-2015 03:49 PM
How to do arithmatic operation on floating number by using expr ??? raman.kumar Linux - Newbie 2 05-18-2009 07:02 AM
bash loop within a loop for mysql ops br8kwall Programming 10 04-30-2008 03:50 AM
BASH - while loop snorkytheweasel Linux - Desktop 2 03-26-2008 09:36 PM
Bash for loop Genjix Programming 5 12-23-2004 02:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration