Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Updating specific fields with awk using conditions Post 302323633 by giannicello on Monday 8th of June 2009 03:15:39 PM
Old 06-08-2009
Thank you. This was a very good solution since I already had a lookup table so no need to hardcode.

-Gianni
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk summing specific lines and fields

Hi I would like to know if it is possible to sum some specific fields. I have this x;x;x;x;x;x;x;x;467,390,611 Bytes;0.435291 GB;0.062247 GB;0.373045 GB;11,225;157 a;a;a;a;a;a;a;a;13,805,156,846 Bytes;12.857054 GB;1.838559 GB;11.018495 GB;151,063;18,933 b;b;b;b;b;b;b;b;232,797,478,723... (5 Replies)
Discussion started by: nakaedu
5 Replies

2. UNIX for Dummies Questions & Answers

Read the file and generate specific fields by awk

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)
Discussion started by: Murugesh
1 Replies

3. Shell Programming and Scripting

awk partial string match and add specific fields

Trying to combine strings that are a partial match to another in $1 (usually below it). If a match is found than the $2 value is added to the $2 value of the match and the $3 value is added to the $3 value of the match. I am not sure how to do this and need some expert help. Thank you :). file ... (2 Replies)
Discussion started by: cmccabe
2 Replies

4. Shell Programming and Scripting

awk to output match and mismatch with count using specific fields

In the below awk I am trying output to one file those lines that match between $2,$3,$4 of file1 and file2 with the count in (). I am also trying to output those lines that are missing between $2,$3,$4 of file1 and file2 with the count of in () each. Both input files are tab-delimited, but the... (7 Replies)
Discussion started by: cmccabe
7 Replies

5. Shell Programming and Scripting

awk to combine all matching fields in input but only print line with largest value in specific field

In the below I am trying to use awk to match all the $13 values in input, which is tab-delimited, that are in $1 of gene which is just a single column of text. However only the line with the greatest $9 value in input needs to be printed. So in the example below all the MECP2 and LTBP1... (0 Replies)
Discussion started by: cmccabe
0 Replies

6. Shell Programming and Scripting

Getting max value of specific fields with awk

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)
Discussion started by: sayami00
5 Replies

7. Shell Programming and Scripting

awk to print fields that match using conditions and a default value for non-matching in two files

Trying to use awk to match the contents of each line in file1 with $5 in file2. Both files are tab-delimited and there may be a space or special character in the name being matched in file2, for example in file1 the name is BRCA1 but in file2 the name is BRCA 1 or in file1 name is BCR but in file2... (6 Replies)
Discussion started by: cmccabe
6 Replies

8. UNIX for Beginners Questions & Answers

Grep or awk a unique and specific word across many fields

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)
Discussion started by: daashti
10 Replies

9. Shell Programming and Scripting

awk to assign points to variables based on conditions and update specific field

I have been reading old posts and trying to come up with a solution for the below: Use a tab-delimited input file to assign point to variables that are used to update a specific field, Rank. I really couldn't find too much in the way of assigning points to variable, but made an attempt at an awk... (4 Replies)
Discussion started by: cmccabe
4 Replies
mlib_ImageLookUp2(3MLIB)				    mediaLib Library Functions					  mlib_ImageLookUp2(3MLIB)

NAME
mlib_ImageLookUp2 - table lookup SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_ImageLookUp2(mlib_image *dst, const mlib_image *src, const void **table, const mlib_s32 *offsets, mlib_s32 channels); DESCRIPTION
The mlib_ImageLookUp2() function maps the source image to the destination image by using the user-specified lookup table and an offset. The source and destination images must have the same width and height. The source and destination images can have different data types. See the following table for available variations of the table lookup func- tion on image types: Type [*] BYTE SHORT USHORT INT FLOAT DOUBLE ---------------------------------------------------------------------------------------- MLIB_BIT Y MLIB_BYTE Y Y Y Y Y Y ---------------------------------------------------------------------------------------- MLIB_SHORT Y Y Y Y Y Y ---------------------------------------------------------------------------------------- MLIB_USHORT Y Y Y Y Y Y ---------------------------------------------------------------------------------------- MLIB_INT Y Y Y Y Y Y [*] Each row represents a source data type. Each column represents a destination data type. The source and destination images also can have a different number of channels. The source image can be a single-channel image or can have the same number of channels as the destination image. The lookup table can have one channel or have the same channels as the destination image. See the following table for possible variations on the number of channels in the images and the lookup table: # of channels in # of channels in # of channels in the input image the lookup table the output image -------------------------------------------------------------- 1 n n n 1 n n n n where, n = 1, 2, 3, 4. Each of the following equations is used in the corresponding case shown in the table above. dst[x][y][i] = table[i][src[x][y][0] - offsets[i]] dst[x][y][i] = table[0][src[x][y][i] - offsets[0]] dst[x][y][i] = table[i][src[x][y][i] - offsets[i]] PARAMETERS
The function takes the following arguments: dst Pointer to destination image. src Pointer to source image. table Pointer to lookup table. The data type of the lookup table is the same as that of the destination image.. The format of the lookup table is: table[channel][index] The entries are indexed from 0 to 1, 2, ..., and so on. It is the user's responsibility to provide a lookup table that has enough entries to cover all possible values of the pixel components deducted by the offset in each channel of the source image. offsets Offset values subtracted from the src pixel before table lookup. channels Number of channels in the lookup table. If the number of channels equals 1, then the same table is applied to all channels. Otherwise, the number of channels must be no less than the number of channels in the destination image. RETURN VALUES
The function 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
mlib_ImageLookUp(3MLIB), mlib_ImageLookUp_Inp(3MLIB), mlib_ImageLookUpMask(3MLIB), attributes(5) SunOS 5.11 2 Mar 2007 mlib_ImageLookUp2(3MLIB)
All times are GMT -4. The time now is 10:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy