Problem: Now there are two scripts, I want to match the contents of File1 by File2
[email protected] home]# cat file13-1-1 potv=1,pota=0,potp=21-4-76 potv=1,pota=0,potp=12-1-2 potv=1,pota=1,potp= 13-1-4 potv=1,pota=1,potp=24-1-5 potv=1,pota=1,potp=27-1-2 potv=1,pota=1,potp=23-1-10 POTV=1,POTA=1,POTP=21-1-1 Potv=1,pota=2,potp=0
[email protected] home]# cat file21-1-12-1-22-1-33-1-44-1-5
Equivalent to the exact match of grep, but the grep-w ' 1-1-1 ' file1 implemented with awk implements the value with the for in loop, assigning the variable a substitution idea to change the match into a variable with a for in loop, and then match the replace for I in ' cat file2 ' doawk ' $1== ' ' $i ' "' {print $} ' file1 >> urfileDone
awk ' $1== ' ' $i ' ' ' ' {print $} ' file1 the single quotation mark in this paragraph is an act of de-justification that precisely matches characters in awk, The character needs to be quoted in double quotes: that is, awk ' $1== ' 1-1-1 ' {print $} ' test, so to pass the argument, use single quotation marks to de-enclose the double quotation mark to allow awk to recognize
Single-quote pairs appear in accordance with the nearest principle
Match shell variable characters in awk