There really isn't any need to count the number of times you have seen an ID in the lookup[] and seen[] arrays. Assuming that your sample input data isn't really representative of the sizes of your real input files, the following suggestion might be faster or slower than Scrutinizer's suggestion since it handles the list of IDs in lookup[] (from the 1st input file) and the list of IDs in seen[] (from the 2nd input file) differently:
Scrutinizer's code trims lookup[] and adds entries to seen[] as it processes each input line. So seen[] will only contain elements that had previously been in lookup[].
The following code doesn't look at lookup[] while its reading the 2nd input file. It adds elements to seen[] for each ID found in field 5 in lines in the 2nd input file. It then makes a single walk through lookup[] at the end removing entries for IDs that are also found in seen[]. (Note that this might be a little more portable to other versions of awk because it doesn't depend on being able to use length(array name) which is an extension not required by the standards.)
You might want to compare the time taken by our two approaches with some of your real data.
which, with your sample input files produces the output:
If you don't want the additional information shown in red in the output above, remove the code shown in red in the above script.
What am I doing wrong here? Or is this not possible?
A bug?
alias f='find . >found 2>/dev/null &'
f ; sleep 20 ; ls -l
-bash: syntax error near unexpected token `;' (2 Replies)
Hi,
Is there a way in Korn Shell that I can run multiple commands stored as a semi-colon separated string, e.g.,
# vs="echo a; echo b;"
# $vs
a; echo b;
I want to be able to store commands in a variable, then run all of it once and pipe the whole output to another program without using... (2 Replies)
I'm using AIX 5.3 and running a awk replace to modify data as follows:
echo 1234: 1234 123 123 444 555 666 7777 | awk '/^:/{split($2,N);n=N} {n=$1} {sub(n,n+10000000)}1'
10001234 1234 123 123 444 555 666 7777
dumb question.. how do I get the colon back in, so it outputs
10001234: 1234... (4 Replies)
Hi All,
I need a unix script to convert .csv files to .skv files (changing a comma delimited file to a semi colon delimited file). I am a unix newbie and so don't know where to start. The script will be scheduled using cron and needs to convert each .csv file in a particular folder to a .skv... (4 Replies)
After some thought.
I am uncomfortable issuing my professors name where, there may be unintended side effects from any negative responses/feedback. Willing to re post if I can omit school / professor publicly, but can message moderator for validation? I am here for knowledge and understanding,... (1 Reply)
Hi All
I have a problem that I am not able to resolve.
Briefly, I have a file like this:
ID_1 10
ID_2 15
ID_3 32
ID_4 45
ID_5 66
ID_6 79
ID_7 88This file is numerically ordered for the 2th column.
And another file containing a list of IDs(just one in this example)
ID_4What I... (7 Replies)
Hi,
I need to filter my data based on items in column 23. Column 1 until column 23 are tab separated. This is how column 23 looks like:
PRIMARY=<0/1:504:499,5:.:.:.:0.01:1:15:.>
I want to extract lines if items 7 (separated by : ) in column 23 are more than 0.25 . In example above , item... (2 Replies)
Trying to get the unique count of the below input, but if the text in beginning of $5 is a partial match to another line in the file then it is not unique.
awk
awk '!seen++ {n++} END {print n}' input
7 input
chr1 159174749 159174770 chr1:159174749-159174770 ACKR1
chr1 ... (2 Replies)
shell : bash
os : RHEL 7.2
I have a file like below
61265388
1-11Y5C-7690
1-11Y4Q-6763
INSERT INTO emp VALUES('oramds:test.xref','CBS_01','MIGWO161265388','61265388','N',SYSDATE);
INSERT INTO emp VALUES('oramds:test.xref','COMMON','MIGWO161265388','MIG1COMMON61265388','N',SYSDATE);... (3 Replies)
Discussion started by: kraljic
3 Replies
LEARN ABOUT SUNOS
mlib_imagelookup
mlib_ImageLookUp(3MLIB) mediaLib Library Functions mlib_ImageLookUp(3MLIB)NAME
mlib_ImageLookUp - table lookup
SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ]
#include <mlib.h>
mlib_status mlib_ImageLookUp(mlib_image *dst, const mlib_image *src, const void **table);
DESCRIPTION
The mlib_ImageLookUp() function maps the source image to the destination image by using the user-specified lookup table.
The source and destination images must have the same width and height. The source image can be a single channel image or can have the same
number of channels as the destination image. One of the following equations is used accordingly:
dst[x][y][i] = table[i][src[x][y][0]]
dst[x][y][i] = table[i][src[x][y][i]]
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.
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 the destination image. The number of entries in
the lookup table is determined by the type of the input image. The format of the lookup table is:
table[channel][index]
The MLIB_BIT type entries are indexed from 0 to 1. The MLIB_BYTE type entries are indexed from 0 to 255. The MLIB_SHORT
type entries are indexed from -32768 to -1, then from 0 to 32767. The MLIB_USHORT type entries are indexed from 0 to 65535.
The MLIB_INT type entries are indexed from -2147483648 to -1, and then from 0 to 2147483647.
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 |Evolving |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO mlib_ImageLookUp_Inp(3MLIB), mlib_ImageLookUp2(3MLIB), mlib_ImageLookUpMask(3MLIB), attributes(5)SunOS 5.10 10 Nov 2004 mlib_ImageLookUp(3MLIB)