For your first question in post #7, try
Your second, recently updated question can be handled in a similar way, but your attempt has some errors:
- the MIN array doesn't exist any more, so for (i in MIN) won't work.
- you don't have different files for different lines as requested, but just two for KOL anbd ROWB
- lines not matching anywhere are lost.
- the indexing of the arrays, although working with for (i in ...) may lead to surprises in other context.
Hi Rudi,
Thanks for the input, basis on your comments I have modified as below & getting expected output. Please suggest if this would be ok from efficiency perspective as one file will be iterated twice.
---------- Post updated 12-11-14 at 09:24 AM ---------- Previous update was 12-10-14 at 05:10 PM ----------
Updated code to be referred as below, please help on this
If you're happy with the result, I think we're done. There's no file being iterated twice. And, instead of using substr several times, you could put its result into a variable and use that four times.
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)
Hi All, I will need an help with respect to replacing a range of columns on a non-delimited file using a particular string pattern.
Say file input is
MYNUMBERD000000-BAN CHUE INSNTS ** N+
MYAREDSDD000000+BAN CHUE INSNTS ** N+
MYDERFFFSD00000-GIR PENT - ACH ** ... (5 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 all,
I would like to compare a column in one file to a column in another file and when there is a match it prints the first column and the corresponding second column. Example
File1
ABA
ABC
ABE
ABF
File 2
ABA 123
ABB 124
ABD 125
ABC 126
So what I would like printed to a... (6 Replies)
Hi,
Can any one help with my below requirement.
i need to compare each line by line and in each line i have to compare some columns values with previous line column values in perl script.
Can any one help me........! its very urgent.
Thanks (3 Replies)
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)
- I am looking for different kind of awk solution which I don't think is mentioned before in these forums.
Number of rows in the file are fixed
Their are two columns in file1.txt
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
I am looking for 3... (1 Reply)