Sponsored Content
Top Forums Shell Programming and Scripting Match ids and print original file Post 302777511 by nans on Friday 8th of March 2013 04:17:16 AM
Old 03-08-2013
Thank you but that only prints the positions which match with the original file.
The desired output is to print all 5000 entries from the original file whether or not it has a 3rd value.

Eg:
chr1 12345 0.07
chr1 6789 NULL
chr1 13456 0.78
.....
chr22 465546 0.12
chr22 6757657 NULL
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

print remaining part from the first-match within a file

Hi, i was looking for unix command(s) for : find the first occurrence of a given pattern with in a file and print the remaining part. below is an example of what i am looking for: lets say, a file named myfile.txt now, the command i am looking for will do the following (4 Replies)
Discussion started by: nurulamin862
4 Replies

2. Shell Programming and Scripting

Strings from one file which exactly match to the 1st column of other file and then print lines.

Hi, I have two files. 1st file has 1 column (huge file containing ~19200000 lines) and 2nd file has 2 columns (small file containing ~6000 lines). ################################# huge_file.txt a a ab b ################################## small_file.txt a 1.5 b 2.5 ab ... (4 Replies)
Discussion started by: AshwaniSharma09
4 Replies

3. Shell Programming and Scripting

print when column match with other file

Hello all, please help. There are two file like this: file1: 1197510.0 294777.7 9666973.0 21.6 1839.8 1197510.0 294777.7 9666973.0 413.2 2075.9 1197510.0 294777.7 9666973.0 689.3 2260.0 ... (1 Reply)
Discussion started by: attila
1 Replies

4. UNIX for Dummies Questions & Answers

Match values/IDs from column and text files

Hello, I am trying to modify 2 files, to yield results in a 3rd file. File-1 is a 8-columned file, separted with tab. 1234:1 xyz1234 blah blah blah blah blah blah 1234:1 xyz1233 blah blah blah blah blah blah 1234:1 abc1234 blah blah blah blah blah blah n/a RRR0000 blah blah blah... (1 Reply)
Discussion started by: ad23
1 Replies

5. Shell Programming and Scripting

AWK print and retain original format

I have a file with very specific column spacing formatting, I wish to do the following: awk '{print $1, $2, $3, $4, $5, $6, $19-$7, $20-$8, $21-$9, $10, $11, $12}' merge.pdb > vector.pdb but the format gets ruined. I have tried with print -f but to no avail.... (7 Replies)
Discussion started by: chrisjorg
7 Replies

6. Shell Programming and Scripting

Match and print columns in second file

Hi All, I have to match each row in file 1 with 1st row in file 2 and print the corresponding column from file2. I am trying to use an awk script to do this. For example cat File1 X1 X3 X4 cat File2 ID X1 X2 X3 X4 A 1 6 2 1 B 2 7 3 3 C 3 8 4 1 D 4 9 1 1 (3 Replies)
Discussion started by: newpro
3 Replies

7. Shell Programming and Scripting

Match ids

Hello, I have two files File 1 with 10 columns rsid position ........ xx 1:10000 File 2 position 1:10000 2:2000 .... I need to extract the IDs given in file 2(column1) from file 1 (column2) and print all columns from file1. I am trying this command (1 Reply)
Discussion started by: nans
1 Replies

8. UNIX for Beginners Questions & Answers

Count multiple columns and print original file

Hello, I have two tab files with headers File1: with 4 columns header1 header2 header3 header4 44 a bb 1 57 c ab 4 64 d d 5 File2: with 26 columns header1.. header5 header6 header7 ... header 22...header26 id1 44 a bb id2 57 ... (6 Replies)
Discussion started by: nans
6 Replies

9. UNIX for Beginners Questions & Answers

Match duplicate ids in two files

I have two text files. File 1 has 150 ids but all the ids exists in duplicates so it has 300 ids in total. File 2 has 1500 ids but all exists in duplicates so file 2 has 300 ids in total. i want to match the first occurance of every id in file 1 with first occurance of thet id in file 2 and 2nd... (2 Replies)
Discussion started by: limd
2 Replies

10. Shell Programming and Scripting

awk to print match or non-match and select fields/patterns for non-matches

In the awk below I am trying to output those lines that Match between file1 and file2, those Missing in file1, and those missing in file2. Using each $1,$2,$4,$5 value as a key to match on, that is if those 4 fields are found in both files the match, but if those 4 fields are not found then missing... (0 Replies)
Discussion started by: cmccabe
0 Replies
Ns_String(3aolserver)					   AOLserver Library Procedures 				     Ns_String(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_Match, Ns_NextWord, Ns_StrCaseFind, Ns_StrCopy, Ns_StrDup, Ns_StrNStr, Ns_StrToLower, Ns_StrToUpper, Ns_StrTrim, Ns_StrTrimLeft, Ns_Str- TrimRight, Ns_StringPrint, ns_strcopy, ns_strdup - library procedures SYNOPSIS
#include "ns.h" char * Ns_Match(char *a, char *b) char * Ns_NextWord(char *line) char * Ns_StrCaseFind(char *s1, char *s2) char * Ns_StrCopy(char *str) ns_strcopy(char *str) char * Ns_StrDup(char *str) ns_strdup(char *str) char * Ns_StrNStr(char *pattern, char *expression) char * Ns_StrToLower(char *string) char * Ns_StrToUpper(char *string) char * Ns_StrTrim(char *string) char * Ns_StrTrimLeft(char *string) char * Ns_StrTrimRight(char *string) void Ns_StringPrint(char *string) _________________________________________________________________ DESCRIPTION
Ns_Match(a, b) Compare the beginnings of two strings, case insensitively. The comparison stops when the end of the shorter string is reached. Return NULL if no match, b if match. Ns_NextWord(line) Return a pointer to first character of the next word in a string; words are separated by white space. The returned pointer points into the original string. For example, Ns_NextWord("abc def") returns a pointer to the 'd' in that string. Ns_StrCaseFind(s1, s2) Locate the first occurrence of substring s2 within string s1 in a case-insensitive manner. The terminating ' ' characters are not compared. Returns a pointer that points into s1. Uses strstr(3) to do its work. Ns_StrCopy(str) ns_strcopy(str) Copy a string or NULL value using Ns_Malloc. The Ns_StrCopy function is identical to the Ns_StrDup function but allows for the string parameter to be NULL, in which case Ns_StrCopy does nothing and returns NULL. Ns_StrDup(str) ns_strdup(str) Copy a string using Ns_Malloc. The Ns_StrDup function calls Ns_Malloc to allocate enough memory to make a copy of the given string. Ns_StrNStr(pattern, expression) Search through pattern for expression, case insensitively. Return a pointer that points to where the match begins within pattern, or NULL if expression is not contained in pattern. Ns_StrToLower(string) Convert string to lowercase. Returns pointer to original string. Original string will be modified. Ns_StrToUpper(string) Convert string to uppercase. Returns pointer to original string. Original string will be modified. Ns_StrTrim(string) Trim leading and trailing white space from string. A pointer to the trimmed string will be returned, which will be in the original string. Do not lose your original pointer to the string if you later need to free it. Ns_StrTrimLeft(string) Trim leading white space from string. A pointer to the trimmed string will be returned, which will be in the original string. Do not lose your original pointer to the string if you later need to free it. Ns_StrTrimRight(string) Trim trailing white space from string. The original string pointer will be returned, but the string will have been modified: a ' 's will have been placed right after the last non-whitespace character of the string. Ns_StringPrint(string) Print a string to stdout. SEE ALSO
nsd(1), info(n) KEYWORDS
AOLserver 4.0 Ns_String(3aolserver)
All times are GMT -4. The time now is 12:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy