我知道如何打印每第n行和第n個匹配行,但不知道如何打印每第n個匹配行並且所有行都不是數學。awk打印每第n個匹配行並且所有行不是數學
輸入例:
Something else 1
Downloading: file1 1%
Downloading: file1 10%
Something else 2
Downloading: file1 30%
Something else 3
Downloading: file1 40%
Downloading: file2 50%
Downloading: file1 60%
Downloading: file1 100%
Downloading: file2 100%
Something else 4
如果圖案是 '^下載:' 和打印每一第二匹配線,輸出應該是這樣的:
Something else 1
Downloading: file1 10%
Something else 2
Something else 3
Downloading: file1 40%
Downloading: file1 60%
Downloading: file2 100%
Something else 4
顯示輸入片段nd預期輸出 – RomanPerekhrest