無法使用lz4解壓縮多個文件

無法使用lz4解壓縮多個文件

我有超過 100 個 lz4 文件,其命名如下:

-rw-r--r-- 1 root root 210M Apr 11 10:11 compressedfile.1-0.lz4
-rw-r--r-- 1 root root 208M Apr 11 11:35 compressedfile.1-1.lz4
-rw-r--r-- 1 root root 185M Apr 11 12:49 compressedfile.2-0.lz4
-rw-r--r-- 1 root root 193M Apr 11 13:06 compressedfile.2-1.lz4
-rw-r--r-- 1 root root 201M Apr 11 14:28 compressedfile.3-0.lz4
-rw-r--r-- 1 root root 236M Apr 11 15:02 compressedfile.3-1.lz4
....

這些文件是巨大的 csv 文件,如下所示:

10.27.221.233,11,TCP,SSL,66,8578,0,,(null),510-12
10.133.205.134,10,UDP,ICMP,26,3470,1,,(null),515-10
10.92.160.173,10,TCP,SSL,66,8578,0,,(null),510-15
10.132.81.71,11,TCP,SSL,0,2,0,,(null),511-10

我需要過濾掉使用 SSL 的 IP 位址。我的方法是這樣的:

lz4 -dc compressedfile.1-0.lz4 | awk -F, '{if ($4=="SSL") print $1}'

這僅適用於一個文件。我嘗試使用通配符處理多個文件,如下所示:

lz4 -dc compressedfile.*.lz4 | awk -F, '{if ($4=="SSL") print $1}'

Warning : compressedfile.1-1.lz4 won't be used ! Do you want multiple input files (-m) ? 
Warning : compressedfile.2-0.lz4 won't be used ! Do you want multiple input files (-m) ?
Warning : compressedfile.2-1.lz4 won't be used ! Do you want multiple input files (-m) ?
....
10.27.221.233
10.92.160.173
10.132.81.71
10.140.81.238
10.92.5.90
....
<it ends with the IP (with SSL) on compressedfile.1-0.lz4>

然後我嘗試-m向 lz4 添加選項:

lz4 -mdc compressedfile.*.lz4 | awk -F, '{if ($4=="SSL") print $1}'

建立了壓縮檔案。

我需要您關於在 lz4 上使用通配符的建議。如果可能的話,我試圖避免使用for循環。

答案1

lz4文件可以作為一個單元連接和處理,因此這將起作用:

cat compressedfile.*.lz4 | lz4 -dc | awk -F, '{if ($4=="SSL") print $1}'

相關內容