回复 1# 每天几分
将- BEGIN {
- FS = ""
- F1 = gensub(/\\/, "/", "g", F1)
- F2 = gensub(/\\/, "/", "g", F2)
- F3 = gensub(/\\/, "/", "g", F3)
- while ((getline < F1) > 0) {
- n1 = split($0, a, FS)
- (getline < F2)
- n2 = split($0, b, FS)
- if (n1 == n2) {
- c = d = o_id = ""
- for (i = 1; i <= n1; ++i) {
- if (a[i] != b[i]) {
- c = c a[i]
- d = d b[i]
- o_id = 1
- }
- }
- if (o_id) {
- print(c "\241\372" d) > F3
- }
- }
- }
- }
复制代码 以ANSI编码格式保存为"D:\桌面\python\新建文件夹\a.awk"。
确保"D:\桌面\python\新建文件夹\1.txt"及"D:\桌面\python\新建文件夹\2.txt"的文件结构完全一致,并且已保存为ANSI编码格式。
下载gawk ( http://bcn.bathome.net/tool/4.1.0/gawk.exe ),放置为"D:\桌面\python\新建文件夹\gawk.exe",执行:- "D:\桌面\python\新建文件夹\gawk.exe" -vF1="D:\\桌面\\python\\新建文件夹\\1.txt" -vF2="D:\\桌面\\python\\新建文件夹\\2.txt" -vF3="D:\\桌面\\python\\新建文件夹\\3.txt" -f"D:\桌面\python\新建文件夹\a.awk"
复制代码
|