Hi
I would like to know if it is possible to sum some specific fields.
I have this
I need to sum fields 9,10,11,12 except any line cotaining wording "Parent Line ...#
so currently I am doing something like grep -v -i "Parent" >new file,
then awk to print specific fields to new files,
and doing it through it.
for this case desired output would be to sum only lines
Edit: adding more information:
I have a very long list nearly 1100 lines,
Each line is very similar to these
And I need to sum all fields to obtain: the total number of bytes, and GB. (while removing those lines that contain wording "Parent: Line"
For my example the total number of bytes and gigabytes, would be something similar to:
I get those numbers by summing all the row of fields $9, $10, $11, $12
I have to apologize, my original post is not clear enough.
I have removed my original requirement to sum fields $13 and $14 because it is adding complexity and I don't really require them for the moment.
I will try to clarify my requirement,
I have a very long list nearly 1100 lines,
Each line is very similar to these
And I need to sum all fields to obtain: the total number of bytes, and GB. (while removing those lines that contain wording "Parent: Line"
For my example the total number of bytes and gigabytes, would be something similar to:
I get those numbers by summing all the row of fields $9, $10, $11, $12
Hi there,
I have data with similar structure as this:
CHR START-SNP END-SNP REF ALT PATIENT1 PATIENT2 PATIENT3 PATIENT4
chr1 69511 69511 A G homo hetero homo hetero
chr2 69513 69513 T C . hetero homo hetero
chr3 69814 69814 G C . . homo homo
chr4 69815 69815 C A hetero . . hetero
is... (10 Replies)
In the awk below, what I am attempting to do is check each line in the tab-delimeted input, which has ~20 lines in it, for a keyword
SVTYPE=Fusion. If the keyword is found I am splitting $3 using the . (dot) and reading the portion before and after the dot in an array a.
If it does have that... (12 Replies)
Hello All,
Here is am trying to get maximum value of third field depending on
first,second and fourth fields with awk command . delimeter is pipe(|) .
input
0221|09|14.25|aaa
0221|09|44.27|aaa
0221|09|44.33|aaa
0221|09|44.53|bbb
0221|09|34.32|bbb
0221|09|37.13|bbb... (5 Replies)
Hi
I need to generate these output file from the below input file.
Output :
customer_id as customer,
zip as zip_cd,
catg_cd as catg,
Input:
out.customer::in.customer_id;
out.zip_cd::in.zip;
out.catg::in.catg_cd;
Could you please help me on this.
Please use code tags next... (1 Reply)
I was playing around to see how stuff works, and was trying to sum all fields in a file.
cat file
1 2 3 4
5 6 7 8
9 10 11 12
I made this script:
awk 'BEGIN {OFS=RS}{$1=$1}{s+=$0} END {print "sum="s}' file
This gives 15, why not 78?
I test it like this
awk 'BEGIN... (5 Replies)
Hi friends,
This is sed & awk type question. It is slightly different from my previous question.
I have a text file which has numbers spread all over the file. I want to sum the series of numbers (but no more than 10 numbers in series) whenever i find it and produce an output file with the... (4 Replies)
Hi friends,
This is sed & awk type question.
I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example
###start of input text file ####
abc
def
ghi
1
2
3
4
kjld
random... (3 Replies)
Can someone help me again, I think with awk? I have a file with 4 columns (pipe-delimited):
I just want to convert the last field so that e1 is now 'message 1', e2 is 'message 2', e0 is 'message 3', etc. I don't want to change any other columns because the e0-e10 code may appear as part of a... (4 Replies)
Hi,
I have a fixed width file with some records as given below:
" 1000Nalsdjflj243324jljlj"
"-0300Njfowjljl309933fsf"
" 0010Njsfsjklj342344fsl"
I want to sum-up first field values(i.e from 2nd character to 6th character)of each record.
so for the above file i want to add (1000 - 300+... (2 Replies)