[英]IGNORECASE in file comparison with awk
Here is my code: 这是我的代码:
'FNR==NR {a[$1 FS $2 FS $3 FS $4]++; next} !a[$1 FS $2 FS $3 FS $5]' comparegam.txt workstudyusers1.csv >noidea6.txt
it is doing exactly what I need except I need to ignorecase. 它确实在做我所需要的,除了我需要忽略大小写。 I have tried using IGNORECASE=1 in various places but I cant get it to work.
我尝试在各种地方使用IGNORECASE = 1,但无法正常工作。 it either fails, gives me zero results, or ignores it all together.
它要么失败,要么给我零结果,要么全部忽略。 I tried using BEGIN [IGNORECASE = 1} with no luck.
我尝试使用BEGIN [IGNORECASE = 1}时没有运气。
any help would be appreciated, I am at a lost. 任何帮助,我们将不胜感激。 I am running this in a terminal window, not from a bash script yet.
我正在终端窗口中运行它,而不是从bash脚本中运行。 that is the end goal
那是最终目标
Note: Output has to contain case to match original files 注意:输出必须包含大小写以匹配原始文件
Here is the exact code that I have tried with IGNORECASE: 这是我尝试使用IGNORECASE的确切代码:
awk -F, 'IGNORECASE=1 FNR==NR {a[$1 FS $2 FS $3 FS $4]++; next} !a[$1 FS $2 FS $3 FS $5]' comparegam.txt workstudyusers1.csv >noidea6.txt
awk -F, 'FNR==NR {IGNORECASE=1} {a[$1 FS $2 FS $3 FS $4]++; next} !a[$1 FS $2 FS $3 FS $5]' comparegam.txt workstudyusers1.csv >noidea6.txt
awk -F, '{IGNORECASE = 1} FNR==NR {a[$1 FS $2 FS $3 FS $4]++; next} !a[$1 FS $2 FS $3 FS $5]' comparegam.txt workstudyusers1.csv >noidea6.txt
awk -F, 'BEGIN {IGNORECASE = 1} FNR==NR {a[$1 FS $2 FS $3 FS $4]++; next} !a[$1 FS $2 FS $3 FS $5]' comparegam.txt workstudyusers1.csv >noidea6.txt
awk -F, 'FNR==NR {{IGNORECASE=1} a[$1 FS $2 FS $3 FS $4]++; next} !a[$1 FS $2 FS $3 FS $5]' comparegam.txt workstudyusers1.csv >noidea6.txt
and various iterations of these. 以及这些的各种迭代。
'
FNR==NR {
a[tolower($1 FS $2 FS $3 FS $4)]++;
next
}
!a[tolower($1 FS $2 FS $3 FS $5)]
' comparegam.txt workstudyusers1.csv >noidea6.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.