10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
i'm new to awk, and i've been searching on the forum for sum of a column but all the scripts does sum a column of an entire file.
I've a file like this:
cat file.txt
1234 5678
5678 1234
I want to use awk to do sum of each column per line not entire file, compare the two then write the... (1 Reply)
Discussion started by: chofred
1 Replies
2. Shell Programming and Scripting
I'm looking for an efficient way to sum elements from 2 arrays using AWK and preserve header as well as sample names in the output array. I have Ubuntu 16.04 LTS. For example;
ARRAY 1
SAMPLE DERIVED ANCESTRAL
Sample1 14352 0
Sample2 14352 0
Sample3 14352 0
Sample4 ... (8 Replies)
Discussion started by: Geneanalyst
8 Replies
3. UNIX for Dummies Questions & Answers
I have a file with data merged from multiple files. File contains header, data and trailer of multiple files. The trailer starts with 99 and delimiter is ~.
Trailer
99~120
99~30
As it is a merged file we i have multiple lines followed by 99~. Need help to find sum of values which are there... (4 Replies)
Discussion started by: santoshdrkr
4 Replies
4. Shell Programming and Scripting
I have a simple text file having payment amount value on each line. At the end of day 'n' number of payments created difference in amount that I need to match from this file.
I have information about how many payments created difference and difference amount. Please help me to build shell... (3 Replies)
Discussion started by: swats007
3 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I would like to be able to sum up the counts of a column by the ID of another column. Example (although the actual file I have has thousands of IDs):
Input file:
A1BG-AS1:001 3
A1BG-AS1:002 0
A1BG-AS1:003 2
A1CF:001 1038
A1CF:002 105
A1CF:003 115
A1CF:004 137
Desired output... (3 Replies)
Discussion started by: fadista
3 Replies
6. Shell Programming and Scripting
I have requirement where I need to capture the highest values of
items from a feed that runs for N hours.
For example lets assume my data looks like this
first feed
========
appples 10
oranges 20
pears 14
second feed
==========
apples 5
oranges 30
pears 1
Last feed... (6 Replies)
Discussion started by: BeefStu
6 Replies
7. Shell Programming and Scripting
I have the following csh script which lets the use pass the following as an argument
-legend=tag1/tag2/tag3/tag4/tag5/tag6/tag7
We pass a number of tags separated by '/'. I want to save the legend tags in an array and have done as below. How can I improve on this as things are getting quite... (3 Replies)
Discussion started by: kristinu
3 Replies
8. Shell Programming and Scripting
I am running the following script :
cat ind_sls_extr_UX.out_sorted | while read each_rec
do
count=`echo "${each_rec}" | cut -c1-2`
if
then
final_amount=0
amount=`echo "${each_rec}" | cut -c280-287`
echo "${amount}"
final_amount=`expr ${amount} + ${amount}`
... (7 Replies)
Discussion started by: mady135
7 Replies
9. Shell Programming and Scripting
Hi.
Im looking for way to sum numbers from top. For example i have such command
top -b -n | grep Cpu | cut -c 35 - 39
which give me output 97.0 . Ho can i do with that value any arithmetic actions (for example 97.0 +1)?
Using
c = $((top -b -n | grep Cpu | cut -c 35 - 39))
gives me... (8 Replies)
Discussion started by: qdf
8 Replies
10. Shell Programming and Scripting
I have a file file like this. I want to sum all column 1 values.
input
A 2
A 3
A 4
B 4
B 2
Out put
A 9
B 6 (3 Replies)
Discussion started by: suresh3566
3 Replies