GAWK代码在Linux和Windows的区别

简介: 如果你的awk代码可以在Linux可以跑,在Windows下却不行,请检查代码中是否有百分号%,将所有%转义为%%。 例如我的这段处理Nginx日志时间的代码:   date = substr($2,2,11) time = substr($2,14,8) gsub("/"," ...

如果你的awk代码可以在Linux可以跑,在Windows下却不行,请检查代码中是否有百分号%,将所有%转义为%%。

例如我的这段处理Nginx日志时间的代码:

 

date = substr($2,2,11)
time = substr($2,14,8)
gsub("/"," ",date)
command = "gdate -d \"" date " " time "\" +%%s"
command | getline datetime
 
目录
相关文章
|
5天前
|
安全 Linux 生物认证
Nexpose 8.25.0 for Linux & Windows - 漏洞扫描
Nexpose 8.25.0 for Linux & Windows - 漏洞扫描
39 0
Nexpose 8.25.0 for Linux & Windows - 漏洞扫描
|
22天前
|
安全 Linux iOS开发
Binary Ninja 5.1.8104 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
Binary Ninja 5.1.8104 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
194 53
Binary Ninja 5.1.8104 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
|
8天前
|
安全 Linux 生物认证
Nexpose 8.24.0 for Linux & Windows - 漏洞扫描
Nexpose 8.24.0 for Linux & Windows - 漏洞扫描
53 1
Nexpose 8.24.0 for Linux & Windows - 漏洞扫描
|
8天前
|
SQL 安全 Linux
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
65 1
Metasploit Pro 4.22.8-20251014 (Linux, Windows) - 专业渗透测试框架
|
10天前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
119 1
Metasploit Framework 6.4.95 (macOS, Linux, Windows) - 开源渗透测试框架
|
22天前
|
Linux API iOS开发
Binary Ninja 4.2.6455 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
Binary Ninja 4.2.6455 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
125 14
Binary Ninja 4.2.6455 (macOS, Linux, Windows) - 反编译器、反汇编器、调试器和二进制分析平台
|
6天前
|
Linux 虚拟化 iOS开发
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
58 0
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
|
1月前
|
安全 Linux 网络安全
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
204 2
Metasploit Pro 4.22.8-2025091701 (Linux, Windows) - 专业渗透测试框架
|
1月前
|
JSON 安全 Linux
Nexpose 8.22.0 for Linux & Windows - 漏洞扫描
Nexpose 8.22.0 for Linux & Windows - 漏洞扫描
91 1
Nexpose 8.22.0 for Linux & Windows - 漏洞扫描
|
1月前
|
Linux 网络安全 iOS开发
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架
302 1
Metasploit Framework 6.4.90 (macOS, Linux, Windows) - 开源渗透测试框架