I have 2 tab-delimited input files as follows.
file1.tab:
file2.tab:
Objective:
Return $1 of file1 if,
. $1 of file2 matches $3 of file1 and,
. any single element (separated by ";") in $3 of file2 is present in $2 of file1
In order to get:
The following code returns a blank output, since it seems to retain only the last iteration of file1.
I am trying to print the output of a command to two separate files. Is it possible to use awk to print $1 to one file and $2 to another file?
Thanks in advance! (1 Reply)
Hello!
I am writing a program to run through two large lists of data (~300,000 rows), find where rows in one file match another, and combine them based on matching fields. Due to the large file sizes, I'm guessing AWK will be the most efficient way to do this. Overall, the input and output I'm... (5 Replies)
Hi,
I am working with two tab-delimited files with multiple columns, formatted as follows:
File 1:
>chrom 1 100 A G 20 …(10 columns)
>chrom 1 104 G C 18 …(10 columns)
>chrom 2 28 T C ... (4 Replies)
Hi
I have 2 files as below
File 1
Chr Start End
chr1 120 130
chr1 140 150
chr2 130 140
File2
Chr Start End Value
chr1 121 128 ABC
chr1 144 149 XYZ
chr2 120 129 PQR
I would like to compare these files using awk; specifically if column 1 of file1 is equal to column 1 of file2... (7 Replies)
grep -v will exclude matching lines, but I want something that will print all lines but exclude a matching field. The pattern that I want excluded is '/mnt/svn'
If there is a better solution than awk I am happy to hear about it, but I would like to see this done in awk as well. I know I can... (11 Replies)
Dear AWK-experts!
I did get stuck in the task of combining files after matching fields, so I'm still awkward with learning AWK.
There are 2 files: one containing 3 columns with ID, coding status, and score for long noncoding RNAs:
file1 (1.txt) (>5000 lines)
... (12 Replies)
Hi All
I am having one awk and sed requirement for the below problem.
I tried multiple options in my sed or awk and right output is not coming out.
Problem Description
###############################################################
I am having a big file say file having repeated... (4 Replies)
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)
I apologize in advance, but I continue to have trouble searching for matches between two files and then printing portions of each to output in awk and would very much appreciate some help.
I have data as follows:
File1
PS012,002 PRQ 0 1 1 17 1 0 -1 3 2 1 2 -1 ... (7 Replies)
Hello all, I am having trouble with what should be an easy task, but seem to be missing something fundamental. I have two files, with File 1 consisting of a single field of many thousands of records. I also have File 2 with two fields and many thousands of records.
My goal is that when $1 of... (2 Replies)
Discussion started by: jvoot
2 Replies
LEARN ABOUT MINIX
paste
PASTE(1) General Commands Manual PASTE(1)NAME
paste - paste multiple files together
SYNOPSIS
paste [-s] [-d list] file...
OPTIONS -d Set delimiter used to separate columns to list.
-s Print files sequentially, file k on line k.
EXAMPLES
paste file1 file2 # Print file1 in col 1, file2 in col 2
paste -s f1 f2 # Print f1 on line 1 and f2 on line 2
paste -d : file1 file2
# Print the lines separated by a colon
DESCRIPTION
Paste concatenates corresponding lines of the given input files and writes them to standard output. The lines of the different files are
separated by the delimiters given with the option -s. If no list is given, a tab is substituted for every linefeed, except the last one.
If end-of-file is hit on an input file, subsequent lines are empty. Suppose a set of k files each has one word per line. Then the paste
output will have k columns, with the contents of file j in column j. If the -s flag is given, then the first file is on line 1, the second
file on line 2, etc. In effect, -s turns the output sideways.
If a list of delimiters is given, they are used in turn. The C escape sequences
, , \, and are used for linefeed, tab, backslash,
and the null string, respectively.
PASTE(1)