Match part of string in file2 based on column in file1
I have a file containing texts and indexes. I need the text between (and including ) INDEX and number "1" alone in line. I have managed this:
It works for all indexes.
And then I have second file with years and indexes per year, one per line
I need all indexes for a given year (and ONLY for a given year). I have managed this, too:
What I'd like to do is join the two- so that I would get all the texts from file1 that match indexes printed by second command.
any ideas?
Last edited by Franklin52; 05-28-2013 at 08:56 AM..
Reason: Please use code tags
OK, thanks...
So, as I said, I have two input files.
The first ("yearly book") is structured like this:
I managed this using:
I have hundreds if those "indexes" (1.01, 1.02,...) and doing it manually would be nonsense.
I also have file with list of them in file with all indexes of all yeary books structured like this:
I've managed to extract all indexes for given year:
What I would like to do is join the two commands (or write a combined one) so it would pass all "indexes" from the command below into the command aboce and I would get all texts from file1 I need...
If I understand what you're trying to do, the following seems to work:
If you're using a Solaris/SunOS system, use /usr/xpg4/bin/awk, /usr/xpg6/bin/awk, or nawk instead of awk.
With the input files specified in the 1st message in this thread, the output produced is:
when the script is invoked with no operands and when it is invoked with the operand "1990".
I am trying to use awk to find all the $2 values in file2 which is ~30MB and tab-delimited, that are between $2 and $3 in file1 which is ~2GB and tab-delimited.
I have just found out that I need to use $1 and $2 and $3 from file1 and $1 and $2of file2 must match $1 of file1 and be in the range... (6 Replies)
I have a list of IDs in file1 and a list of sequences in file2. I can print sequences from file2, but I'm asking for help in printing the sequences in the same order as the IDs appear in file1.
file1:
EN_comp12952_c0_seq3:367-1668
ES_comp17168_c1_seq6:1-864
EN_comp13395_c3_seq14:231-1088... (5 Replies)
I have two files.
File 1 is a two-column index file, e.g.
comp11084_c0_seq6:130-468(-) comp12746_c0_seq3:140-478(+)
comp11084_c0_seq3:201-539(-) comp12746_c0_seq2:191-529(+)
File 2 is a sequence file with headers named with the same terms that populate file 1. ... (1 Reply)
file1:
file2:
I need to find matches for any lines in file1 that appear in file2. Desired output is '>' plus the file1 term, followed by the line after the match in file2 (so the title is a little misleading):
This is honestly beyond what I can do without spending the whole night on it, so I'm... (2 Replies)
I have very limited coding skills but I'm wondering if someone could help me with this. There are many threads about matching strings in two files, but I have no idea how to add a column from one file to another based on a matching string.
I'm looking to match column1 in file1 to the number... (3 Replies)
hi;
i am looking for simple search script that find string from file1 in file 2
file 1 contain a loot of string like:
204080111111111
204080222222222
204080333333333
in each row
and i would like to take the first row for example 204080111111111 from file1 and find it in file2 when it... (1 Reply)
Match column 3 in file1 to column 1 in file 2 and replace with column 2 from file2
file 1 sample
SNDK 80004C101 AT
XLNX 983919101 BB
NETL 64118B100 BS
AMD 007903107 CC
KLAC 482480100 DC
TER 880770102 KATS
ATHR 04743P108 KATS... (7 Replies)
Hi, i've two files (file1, file2) i want to take value (in column1) and search in file2 if the they match print the value from file2.
this is what i have so far.
awk 'FILENAME=="file1"{ arr=$1 }
FILENAME=="file2"
{print $0}
' file1 file2 (2 Replies)