Sponsored Content
Top Forums Shell Programming and Scripting Adding Column Values Using Pattern Match Post 302784357 by panyam on Friday 22nd of March 2013 04:08:10 AM
Old 03-22-2013
A crude approach

Code:
awk -F"," '{a["ICP_"substr($2,index($2,"MED"))]+=$3} END{ for(i in a) print i,a[i]}' OFS="," file


Last edited by panyam; 03-22-2013 at 05:39 AM.. Reason: Added new code
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem while adding column values in awk

Hi, I have a file "input.txt" with the following content : 5312,0,,,1,8,141.2,20090727 3714,0,,,1,8,285.87,20090727 5426,0,,,1,8,3.9,20090727 3871,0,,,1,8,30.4,20090727 9071,0,,,1,8,146.2,20090727 5141,0,,,1,8,2.8,20090727 0460,0,,,1,8,-0.1,20090727 7918,0,,,1,8,-0.1,20090727... (3 Replies)
Discussion started by: valokv
3 Replies

2. Shell Programming and Scripting

Need help in adding the column to set of lines that match the certain criteria

Hi, I need help to add a certain values to end of each line in the same file. Here is my input file name:aaa id :123 salary job qulification name:bbb id :124 salary job qulification name:ccc id :345 salary job qulification (2 Replies)
Discussion started by: jpkumar10
2 Replies

3. UNIX for Dummies Questions & Answers

Adding column with values

Dear all, I need your help for my question please I have without header (space separated) and need to add two colomns at the beginning with values my file look like : rs1 a t 0.6 rs2 a c 0.3 rs3 t g 0.8 I need to a new file like: 1 100 rs1 a t 0.6 1 100 rs2 a c 0.3 1 100 rs3 t g... (3 Replies)
Discussion started by: biopsy
3 Replies

4. Shell Programming and Scripting

Compare values for a pattern match and execute script

Here in the input file 23:59:13,devicename,21,server1,700 23:59:13,devicename,22,server2,200 23:59:13,devicename,23,server3,200 23:59:13,devicename,24,server4,200 23:59:13,devicename,25,server5,200 23:59:13,devicename,26,server6,200 23:59:13,devicename,27,server7,200... (6 Replies)
Discussion started by: necro98
6 Replies

5. Shell Programming and Scripting

Adding column values in a file

Hi, I am having a file in the following format. for aaaa 1111 1234 2222 3434 for bbbb 1111 3434.343 2222 2343 for cccc 3333 2343.343 4444 89000 for dddd 1111 5678.343 2222 890.3 aaaa 2343.343 bbbb 34343.343 (5 Replies)
Discussion started by: jpkumar10
5 Replies

6. Shell Programming and Scripting

Adding of two column values

Hi cat /tmp/xx.txt 1 4 1 5 1 6 2 1 2 1 2 1 i want to add the values of 2nd column resepect to 1st column values..for 1 in 1st column i need sum of all the values in 2nd column ..pls tell me hw to do it?? (8 Replies)
Discussion started by: Aditya.Gurgaon
8 Replies

7. Shell Programming and Scripting

awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column

Hi, My input files is like this axis1 0 1 10 axis2 0 1 5 axis1 1 2 -4 axis2 2 3 -3 axis1 3 4 5 axis2 3 4 -1 axis1 4 5 -6 axis2 4 5 1 Now, these are my following tasks 1. Print a first column for every two rows that has the same value followed by a string. 2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

8. Shell Programming and Scripting

Adding values of a column based on another column

Hello, I have a data such as this: ENSGALG00000000189 329 G A 4 2 0 ENSGALG00000000189 518 T C 5 1 0 ENSGALG00000000189 1104 G A 5 1 0 ENSGALG00000000187 3687 G T 5 1 0 ENSGALG00000000187 4533 A T 4 2 0 ENSGALG00000000233 5811 T C 4 2 0 ENSGALG00000000233 5998 C A 5 1 0 I want to... (3 Replies)
Discussion started by: Homa
3 Replies

9. UNIX for Dummies Questions & Answers

Match sum of values in each column with the corresponding column value present in trailer record

Hi All, I have a requirement where I need to find sum of values from column D through O present in a CSV file and check whether the sum of each Individual column matches with the value present for that corresponding column present in the trailer record. For example, let's assume for column D... (9 Replies)
Discussion started by: tpk
9 Replies

10. Shell Programming and Scripting

If pattern match in other column, modify column 3.

My command sed will modify everything in column 3 if i will use the command below. I want to search for a pattern then modify everything in column 3. sed -i 's/\|165\|/server1/g' file.txt Input: 01-31-2019 19:14:05|device|165|1548962040165|5c5348f9-0804-1111|file_attach|7271|587|smtp|... (6 Replies)
Discussion started by: invinzin21
6 Replies
mlib_SignalConv_S16_S16_Sat(3MLIB)			    mediaLib Library Functions				mlib_SignalConv_S16_S16_Sat(3MLIB)

NAME
mlib_SignalConv_S16_S16_Sat, mlib_SignalConv_S16S_S16S_Sat, mlib_SignalConv_F32_F32, mlib_SignalConv_F32S_F32S - signal convolution SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_SignalConv_S16_S16_Sat(mlib_s16 *dst, const mlib_s16 *src1, const mlib_s16 *src2, mlib_s32 m, mlib_s32 n); mlib_status mlib_SignalConv_S16S_S16S_Sat(mlib_s16 *dst, const mlib_s16 *src1, const mlib_s16 *src2, mlib_s32 m, mlib_s32 n); mlib_status mlib_SignalConv_F32_F32(mlib_f32 *dst, const mlib_f32 *src1, const mlib_f32 *src2, mlib_s32 m, mlib_s32 n); mlib_status mlib_SignalConv_F32S_F32S(mlib_f32 *dst, const mlib_f32 *src1, const mlib_f32 *src2, mlib_s32 m, mlib_s32 n); DESCRIPTION
Each of these functions performs convolution. For monaural signals, the following equation is used: m-1 dst[i] = SUM (src1[j] * src2[i - j]) if m <= n j=0 n-1 dst[i] = SUM (src2[j] * src1[i - j]) if m > n j=0 where i = 0, 1, ..., (m + n - 2). For stereo signals, the following equation is used: m-1 dst[2*i] = SUM (src1[2*j] * src2[2*(i - j)]) j=0 m-1 dst[2*i + 1] = SUM (src1[2*j + 1] * src2[2*(i - j) + 1]) j=0 if m <= n, or n-1 dst[2*i] = SUM (src2[2*j] * src1[2*(i - j)]) j=0 n-1 dst[2*i + 1] = SUM (src2[2*j + 1] * src1[2*(i - j) + 1]) j=0 if m > n; where i = 0, 1, ..., (m + n - 2). PARAMETERS
Each of the functions takes the following arguments: dst Destination signal array. src1 First source signal array. src2 Second source signal array. m Number of samples in the first source signal array. n Number of samples in the second source signal arrays. RETURN VALUES
Each of the functions returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) SunOS 5.11 2 Mar 2007 mlib_SignalConv_S16_S16_Sat(3MLIB)
All times are GMT -4. The time now is 03:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy