Setting the delimiter


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Setting the delimiter
# 8  
Old 12-12-2007
Quote:
Originally Posted by Trellot
What can I do here?
To me that counts as part of the "presentation layer" and I would keep that separate from the data manipulation.

I would have thought you would want the data independant of the number of tab-stops in whatever display mechanism you use.
# 9  
Old 12-13-2007
I'm good so far, thanks everyone for the info about the tabs. Now I'm trying to calculate the average of a particular field. I know tot(and then the field name)+= will total it, but what about an average?

Trellot
# 10  
Old 12-13-2007
Quote:
Originally Posted by Trellot
I'm good so far, thanks everyone for the info about the tabs. Now I'm trying to calculate the average of a particular field. I know tot(and then the field name)+= will total it, but what about an average?

Trellot
Also, rest assured that I'm not just throwing all of this on all of your good shoulders. I, too, am googling and the like for answers. Just so you all know Smilie

Trel
# 11  
Old 12-13-2007
Quote:
Originally Posted by Trellot
but what about an average?
Er, total elements then divide by number of elements?
# 12  
Old 12-13-2007
Quote:
Originally Posted by porter
Er, total elements then divide by number of elements?
Right, but I'm not figuring out how I divide by 4 (the number of elements) syntactically. So, like I have this:

......
{ printf("8s%15s\n", $1, $4); totRBIs+=$1; avgRBIs/4=$4 }

END { printf("Total RBIs = %8.f\n", totRBIs)
printf("Average RBIs = %8.f\n", avgRBIs)

I'm not sure of the mathematical syntax here....

Trel
# 13  
Old 12-13-2007
Quote:
Originally Posted by Trellot
Right, but I'm not figuring out how I divide by 4 (the number of elements) syntactically. So, like I have this:

......
{ printf("8s%15s\n", $1, $4); totRBIs+=$1; avgRBIs/4=$4 }

END { printf("Total RBIs = %8.f\n", totRBIs)
printf("Average RBIs = %8.f\n", avgRBIs)

I'm not sure of the mathematical syntax here....

Trel
Figured it out...thanks.

Trellot
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to use multiple delimiter?

How to split 2:6..5 in to separate columns (7 Replies)
Discussion started by: Nadela
7 Replies

2. Shell Programming and Scripting

Perl Code to change file delimiter (passed as argument) to bar delimiter

Hi, Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters. Any help would... (2 Replies)
Discussion started by: JPB1977
2 Replies

3. Solaris

Is there a difference between setting a user as nologin and setting it as a role?

Trying to figure out the best method of security for oracle user accounts. In Solaris 10 they are set as regular users but have nologin set forcing the dev's to login as themselves and then su to the oracle users. In Solaris11 we have the option of making it a role because RBAC is enabled but... (1 Reply)
Discussion started by: os2mac
1 Replies

4. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

5. Shell Programming and Scripting

how to get everything before the last delimiter?

hi all, i have a string with a number of "/"s as delimiter. and i want everything BEFORE the last delimiter i know to use basename to get everything after the last delimiter. thx a lot! (2 Replies)
Discussion started by: sunnydanniel
2 Replies

6. Shell Programming and Scripting

How to cut by delimiter, and delimiter can be anything except numbers?

Hi all, I have a number of strings like below: //mnt/autocor/43°13'(33")W/ and i'm trying to get the numbers in this string, for example 431333 please help thanks ahead (14 Replies)
Discussion started by: sunnydanniel
14 Replies

7. Shell Programming and Scripting

Help regarding the delimiter

Hi, I am trying to load data from a file to oracle DB. The file am using has a ";" as a delimiter. While I load the file, I want to check whether the file is having the correct delimiter or not. if not, the file should not be processed. Is there any way that i could handle this scenario using... (3 Replies)
Discussion started by: smileyreddy
3 Replies

8. Shell Programming and Scripting

Substring based on delimiter, finding last delimiter

Hi, I have a string like ABC.123.XYZ-A1-B2-P1-C4. I want to delimit the string based on "-" and then get result as only two strings. One with string till last hyphen and other with value after last hyphen... For this case, it would be something like first string as "ABC.123.XYZ-A1-B2-P1" and... (6 Replies)
Discussion started by: gupt_ash
6 Replies

9. UNIX for Dummies Questions & Answers

Delimiter

I am having the following file. I need to insert a delimiter in this file. I used sed but its not working. AAABBB 9 JJJ AAABBC 9 TTTTT AAABBA 8 JJJ AAABBC 7 TTTTT AAABBC 6 TTTTT Now i want the output file as: AAA|BBB| |9| |JJJ| AAA|BBC| |9| | |TTTTT| (3 Replies)
Discussion started by: sivakumar.rj
3 Replies

10. Shell Programming and Scripting

from - to delimiter

hey guys can you please help me out, i'm having problem in cutting strings. I need a delimiter to cut string. sample a.txt "ID", "1234" , "iam bighippo", "help!" "ID", "1235" , "again0", "xxxxxxx1" "ID", "1236" , "again1", "xxxxxxx2" "ID", "1237" , "again2", "xxxxxxx3" how do... (6 Replies)
Discussion started by: bighippo
6 Replies
Login or Register to Ask a Question