LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-27-2011, 02:28 PM   #16
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,620

Rep: Reputation: 450Reputation: 450Reputation: 450Reputation: 450Reputation: 450

Quote:
Originally Posted by japena View Post
I have to do some more formatting but I think I can take it from here now. Just one more thing, what's the proper format of the awk command in multiple lines?
I am not sure if I understand you correctly. Do you mean something like making the command more *human* readable?
Code:
awk -F ',' '{
min=$1
max=$1
a=0
for (i=1;i<=NF;i++) {
	a += $i
	if ($i < min) {
		min=$i
	}
	if ($i > max){
		max=$i
	}
}
print "average: " a/NF " min: " min " max: " max}' file
 
Old 07-27-2011, 02:31 PM   #17
japena
LQ Newbie
 
Registered: Jul 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Yup exactly what i was looking for, a more "readable" format Thank you for all your help!
 
Old 07-27-2011, 02:47 PM   #18
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,620

Rep: Reputation: 450Reputation: 450Reputation: 450Reputation: 450Reputation: 450
You're welcome. Please mark the thread as SOLVED.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
bash script choice menu from csv file deefke Linux - Newbie 5 01-25-2011 02:31 PM
[SOLVED] bash read csv file daberkow Programming 4 04-28-2010 04:13 AM
Update csv file into mysql db via bash script xmrkite Linux - Software 4 01-13-2010 01:43 AM
[SOLVED] Need help create a bash script to edit CSV File imkornhulio Programming 13 02-05-2009 11:23 AM
Shell script to read from csv file hendemeg Programming 1 05-11-2004 09:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration