02-17-2009
Thanks
Hi Jim ,
My input file basically consist of two files where a,c are part of one file and b and d are part of other file.I need to get only thoes records which bascally match a is equal to b (anywhere in the column) and c is in the same line as b is should be equal to d(anywhere in the coulmn) and then print all a,b,c,d
Appreciate the help in advance
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Everyone,
Here's a snippet of my data:
File 1 = testRef2:
A1BG - 13208 13284
AAA1 - 34758475 34873943
AAAS - 53701240 53715412File 2 = 42MLN.3.bedS2:
13208
13208
13360
13363
13484
13518
13518My awk script:
awk 'NR == FNR{a=$1;next} {$1>=a}{$1<=a}{print... (5 Replies)
Discussion started by: heecha
5 Replies
2. Shell Programming and Scripting
Hi,
Input
7488 7389 chr1.fa chr1.fa
3546 9887 chr5.fa chr9.fa
7387 7898 chrX.fa chr3.fa
7488 7389 chr21.fa chr3.fa
7488 7389 chr1.fa chr1.fa
3546 9887 chr9.fa chr5.fa
7898 7387 chrX.fa chr3.fa
Desired Output
7488 7389 chr1.fa chr1.fa 2
3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I have a file like this
a 1 2
b 2 2
c 2 3
d 4 5
f 5 6
output
a 1 2
c 2 3
d 4 5
f 5 6
Basically, I want to delete the whole line if $2 and $3 are the same. Thanks (5 Replies)
Discussion started by: jacobs.smith
5 Replies
4. Shell Programming and Scripting
I have two files... file1 and file2.
Where columns 1 and 2 of file1 match columns 1 and 2 of file2 I want to create a new file that is all file1 + columns 3 and 4 of file2
:b: Many thanks if you know how to do this.... :b:
file1
31-101 106 0 92
31-101 106 29 ... (2 Replies)
Discussion started by: pelhabuan
2 Replies
5. Shell Programming and Scripting
Hi Friends,
I have the following input file
cat input
chr1 100 200 0.1 0.2 na 1 na nd
chr1 105 200 0.1 0.2 1 1 na 98
chr1 110 290 nf 1 na nd na 1
chr2 130 150 12 3 na 1 na 1
chr3 450 600 nf nf na 10 na nd
chr4 300 330 1 1 10 11 23 34
My requirement is
1. If $6 is na make $7 nd and... (2 Replies)
Discussion started by: jacobs.smith
2 Replies
6. Shell Programming and Scripting
Dear Shell experts,
I have 2 files with structure:
File 1: ID and count
head test_GI_count1.txt
1000094 2
10039307 1
10039641 1
10047177 11
10047359 1
1008555 2
10120302 1
10120672 13
10121776 1
10121865 32
And 2nd file:
head Protein_gi_GeneID_symbol.txt
protein_gi GeneID... (11 Replies)
Discussion started by: smitra
11 Replies
7. Shell Programming and Scripting
Hi all, I know this sounds suspiciously like a homework course; but, it is not.
My goal is to take a file, and match my "ID" column to the "Date" column, if those conditions are true, add the total number of minutes worked and place it in this file, while not printing the original rows that I... (6 Replies)
Discussion started by: mtucker6784
6 Replies
8. Shell Programming and Scripting
Hi all, I'm trying to match the following two files with the code below:
awk -F, 'NR==FNR {a=$0; next} ($12,$4) in a {print $12,$1,a}' OFS="," file4.csv file3.csv
but the code does not print the entire row from file4 in addition to column 12 and 1 of file3.
file4:
o,c,q,co,ov,b... (1 Reply)
Discussion started by: bkane3
1 Replies
9. Shell Programming and Scripting
Hello All,
I have a requirement in which i will be given a sql query as input in a file with dynamic number of columns. For example some times i will get 5 columns, some times 8 columns etc up to 20 columns.
So my requirement is to generate a output query which will have 20 columns all the... (7 Replies)
Discussion started by: vikas_trl
7 Replies
10. UNIX for Beginners Questions & Answers
Hi,
i have 2 files , the data i need to match is in masterfile and i need to pull out column 3 from master if column 1 and 2 match and output entire row to new file
I have tried with join and awk and i keep getting blank outputs or same file
is there an easier way than what i am... (4 Replies)
Discussion started by: axis88
4 Replies
LEARN ABOUT OSF1
getsubopt
getsubopt(3) Library Functions Manual getsubopt(3)
NAME
getsubopt - Parses suboption arguments from a command line
LIBRARY
Standard C Library (libc.so, libc.a)
SYNOPSIS
#include <stdlib.h>
int getsubopt(
char **optionp,
char *tokens[],
char **valuep);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
getsubopt(): XPG4-UNIX
Refer to the standards(5) reference page for more information about industry standards and associated tags.
PARAMETERS
Specifies the address of a pointer to the option string. Specifies an array of possible suboption tokens. Specifies the address of a
value string pointer.
DESCRIPTION
The getsubopt() function parses suboption arguments in a flag argument that was initially parsed by the getopt() function. These suboption
arguments must be separated by commas and may consist of either a single token, or a token-value pair separated by an equal sign. Because
commas delimit suboption arguments in the option string, commas are not allowed to be part of the suboption arguments or the value of a
suboption argument. Similarly, because the equal sign separates a token from its value, a token must not contain an equal sign.
The following command line for the mount command gives an example of this syntax: mount -o ro,nosuid,rsize=8192 paradox:/u2 /u2 In this
example, the suboption consists of three arguments: ro and nosuid (tokens), and rsize=8192 (a token-value pair).
When a suboption argument is found in the *optionp string that matches a string in the token array, the index of the matching string in the
array is returned. If no match is found, then a -1 is returned. After each match, the *optionp string is updated to point past the
matched suboption argument to the next suboption argument in the list. If the suboption argument matched is the last in the string,
*optionp is set to the null pointer. If the suboption argument matched is a token-value pair, then *valuep is set to point to the value.
If there is no value, then *valuep is to the null pointer.
The token array is a list of pointers to strings. The end of the array is signified by a NULL pointer.
RETURN VALUES
Upon successful completion, the getsubopt() function returns the index of the token or suboption argument that matches the suboption argu-
ment in the input string. Otherwise, if no match is found, it returns a value of -1.
ERRORS
No errors are defined for this routine.
RELATED INFORMATION
Functions: getopt(3)
Standards: standards(5) delim off
getsubopt(3)