If the 4th and the 5th filed are floating point then how should i do the the addition below mentioned syntax i am using unabe to add geetting error ---------- Post updated at 03:39 AM ---------- Previous update was at 03:35 AM ----------
for example 151,24.25 124,78.00
123,20.45 123,23.78
Moderator's Comments:
edit by bakunin: it obviously is pretty hard to use CODE-tags. To lighten the burden of doing so this infraction will put you in read-only-mode. I hope this helps.
---------- Post updated at 04:00 AM ---------- Previous update was at 03:39 AM ----------
Quote:
Originally Posted by RudiC
Your sort is missing the key to sort by (unless you want to sort from the start of line), and your awk just prints an empty line when field 1 (not if "name", i.e. field 3) changes and doesn't do any totals. BTW, how do we know "ASH" and "SHA" belong together, i.e. are to be grouped, as well as "FL" and "KL"?
As an interim step, try
If the 4th and the 5th filed are floating poit then how should i will do the the addition below mentioned syntax i am using unabe to add geetting error
Code:
bc |SUM1+=$4
bc |SUM2+=$5
bc |TOT1+=$4
bc |TOT2+=$5
for example 151,24.25 124,78.00
123,20.45 123,23.78
Hi
I have a Fixed format data file where I need to to get the total of the field at certain position in a file for a group of lines.
In this data file I need the total of all the field ats position 30:39 for each line starting with 6 and for each group startign with 5. Which means for... (27 Replies)
I have a file whose format is like the following
350,2,16.2,195,2,8.0
every 3rd column of this file should be deleted. How can i achieve this
tried with the following
iostat -D -l 2 | /usr/xpg4/bin/awk ' NR>2 { for (i=0;i<=NF;i++)if(i%3==0)$i=""};'
but no luck (3 Replies)
Hi,
I am having two tables. A & B
I want to know the total number of records in each table and need to store each value in some variables to process further in the code.
How it can be done ?
With Regards (2 Replies)
Dears,
I need a script or command which can find the unique number from the second filed and against that number it adds the total of first field .
17215630 , 0
907043 ,1
201050 ,10
394149 ,4
1964 ,9
17215630, 0
907043 ,1
201050, 10
394149 ,4
1964 ,9
1234234, 55
23 ,100
33 ,67
... (2 Replies)
Similar question... I have a space delimited text file and I want to only print the lines where the 3rd word/field/column is equal to "01"
awk '{if $3 = "01" print $0}'
something like this.
I meant to say:
only print line IF 3rd field is 01 (2 Replies)
I have made a table PRD_WORK_LM.test and it contains one field, ctrl_test. This field contains a 0 or a 1. I want to write a unix script that goes like this:
IF ctrl_test = 1 THEN ... ELSE exit FI
How can I write this in a script? Do I have to do this within bteq? or outside bteq? can... (5 Replies)
Searched and searched, but could not find a official answer.
In Solaris, on a new server build, all the system accounts look like this:
# cat /etc/shadow
root:#########:6445::::::
daemon:NP:6445::::::
bin:NP:6445::::::
sys:NP:6445::::::
adm:NP:6445::::::
lp:NP:6445::::::... (6 Replies)
Hi Friends,
I have the script output like below:
Script Output:
-----------------------------------------------------------------------
Details of the Client:
-----------------------
name: server1;
save set: All;
... (3 Replies)
Please help me to write a script
Match with ACNO & NAME if it matched calculate the total val1 val2 val3 and val4 and GT is total of ACNO wise.please check the output
Table
-----------------
1005|ANDP|ACN|20|50|10|30
1005|ANDP|ACN|20|10|30|40
1001|AND|NAC|40|50|40|50... (22 Replies)
Trying to use awk to print the lines in file that have either REF or SNV in $3, add a header line, sort by $4 in numerical order. The below code does that already, but where I am stuck is on the last part where the total lines are counted and printed under Total_Targets, under Targets_less_than is... (4 Replies)