regex - use awk to search for match and rename -


I am trying to figure out the solution and hope that someone can help you. I have two files ... There is a long list of unique string coding for some sample sequence (one column) in file 1. File2 has many records and many columns, but here the record organizes unique strings that match the sample views. I want to find a unique string of AWK file 1, in file 2, and want to rename the unique string in file 1, in which the string found in 1 dollar of that file where the unique string was found.

File 1

  id1 id2 id3 id4 id5 id6 id7 id8 id9 id10   

Id2, id2, id33, id35

My actual file 1 $ 1 is approximately 17,000 records in the desired file and approximately 4,000 in file 2. Output

  id1 id2 id3 id4 id5 id6 id5 id5 id1 id10   

Any help with the record, 1-400 field appreciated is!

Here's a different way to awk. Enter the following executable in the awk file:

  #! / Usr / bin / awk -f FNR == NR {F1 [$ 0] = NR; Out [NR] = $ 0; Cnt = nr; {F1_line_num = f1 [f2_line [fld]] if {f1_line_num! = ""} For [f1_line_num] = f2_line [1]}} {END} {for partition {$ 0, f2_line, ","} For (J = 1; J & LT; = CNT; J ++) Print out [j]}   

If you say executable AJAX file Akzo , Then you will run it looks like awko file1 file2 .

Dissolution:

  • Create two arrays of file 1, create a unique ID (< Code> F1 ), other than the line number ( outside ).
  • Each row is in an array ( f2_line ) For each field in f2 , check whether f1 has a line number and it is f1_line_num .
  • If f1_line_num is missing, change the corresponding entry in outside .
  • END , print out in line number order.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -