03-14-2016
what would you recommend as I am struggling to fix it... thank you
.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to match $1 in file1 with $2 in file2. If a match is found then $3 and $4 of file2 are copied to file1. Both files are tab-delimeted and I am getting a syntax error and would also like to update file1 in-place without creating a new file, but am not sure how. Thank you :).
file1
... (19 Replies)
Discussion started by: cmccabe
19 Replies
2. Shell Programming and Scripting
In the below, I am trying to lookup $1 and $2 from file1, in a range search using $1 $2 $3 of file2. If the search key from file1 is found in file2, then the word low is printed in the last field of that line in the updated file1. Only the last section of file1 needs to be searched, but I am not... (6 Replies)
Discussion started by: cmccabe
6 Replies
3. Shell Programming and Scripting
I am trying to update the below awk, kindly provided by @RavinderSingh13, to update each line of file1 with either Low or No Low based on matching $2 of file1 to a range in $2 and $3 of file2. If the $2 value in file1 matches the range in file2 then that line is Low, otherwise it is No Low in the... (3 Replies)
Discussion started by: cmccabe
3 Replies
4. Shell Programming and Scripting
I have a very large tab-delimited, ~2GB file2 that I am trying to filter using $2 of file1. If $2 of file1 is in the range of $2 and $3 in file1 then the entire line of file2 is outputed. If the range match is not found then that line is skipped. The awk below does run but no output results. ... (3 Replies)
Discussion started by: cmccabe
3 Replies
5. Shell Programming and Scripting
I am trying to use awk to update all the unknown values in $6 of file2, if the $4 value in file 2 is within the range of $1 of file1. If there is already a value in $6 other then unknown, it is skipped and the next line is processed. In my awk attempt below the final output is 6 tab-delimited... (6 Replies)
Discussion started by: cmccabe
6 Replies
6. Shell Programming and Scripting
In the out.txt below I am trying to use awk to update the contents of $9.. If $9 contains a + or - then $8 of out.txt is used as a key to lookup in $2 of file. When a match ( there will always be one) is found the $3 value of that file is used to update $9 of out.txt separated by a :. So the... (6 Replies)
Discussion started by: cmccabe
6 Replies
7. Shell Programming and Scripting
In the awk below I am trying to print out those lines in file2 that are no between $2 and $3 in file1. Both files are
tab-delimeted and I think it's close but currently it is printeing out the matches. The --- are not part of the files they are just to show what lines match or fall into
the range... (6 Replies)
Discussion started by: cmccabe
6 Replies
8. Shell Programming and Scripting
In the awk below I am trying to add a penalty to a score to each matching $1 in file2 based on the sum of $3+$4 (variable TL) from file1. Then the $4 value in file1 is divided by TL and multiplied by 100 (this valvue is variable S). Finally, $2 in file2 - S gives the updated $2 result in file2.... (2 Replies)
Discussion started by: cmccabe
2 Replies
9. UNIX for Beginners Questions & Answers
I have two files, file1.table is the count table, and the other is the range condition file2.range.
file1.table
chr start end count
N1 0 48 1
N1 48 181 2
N1 181 193 0
N1 193 326 2
N1 326 457 0
N1 457 471 1
N1 471 590 2
N1 590 604 1
N1 604 752 1
N1 752 875 1
file2.range... (12 Replies)
Discussion started by: yifangt
12 Replies
10. UNIX for Beginners Questions & Answers
In the awk below I am trying to cp and paste each matching line in f2 to $3 in f1 if $2 of f1 is in the line in f2 somewhere. There will always be a match (usually more then 1) and my actual data is much larger (several hundreds of lines) in both f1 and f2. When the line in f2 is pasted to $3 in... (4 Replies)
Discussion started by: cmccabe
4 Replies
GETW(3) Linux Programmer's Manual GETW(3)
NAME
getw, putw - input and output of words (ints)
SYNOPSIS
#include <stdio.h>
int getw(FILE *stream);
int putw(int w, FILE *stream);
DESCRIPTION
getw() reads a word (that is, an int) from stream. It's provided for compatibility with SVr4. We recommend you use fread(3) instead.
putw() writes the word w (that is, an int) to stream. It is provided for compatibility with SVr4, but we recommend you use fwrite(3)
instead.
RETURN VALUE
Normally, getw() returns the word read, and putw() returns 0. On error, they return EOF.
CONFORMING TO
SVr4, SUSv2. Not present in POSIX.1-2001.
BUGS
The value returned on error is also a legitimate data value. ferror(3) can be used to distinguish between the two cases.
SEE ALSO
ferror(3), fread(3), fwrite(3), getc(3), putc(3)
COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU
2007-12-20 GETW(3)