2014-12-04 26 views
1

嘿所以我有一個包含所有這些字節的日誌文件。 我只想grep或awk中的每一行都有數字499,並將其放入一個文本文件中。如何在此文本文件中grep或awk中的所有內容對應我需要的內容?

這裏是一個例子。

Wed Dec 3 12:52:05 2014; UDP; eth1; 32 bytes; from 197.46.140.50:1434 
Wed Dec 3 12:52:05 2014; UDP; eth1; 32 bytes; from 197.46.140.50:1434 
Wed Dec 3 12:52:05 2014; UDP; eth1; 652 bytes; from 197.46.140.50:1434 
Wed Dec 3 12:52:05 2014; UDP; eth1; 32 bytes; from 197.46.140.50:1434 
Wed Dec 3 12:52:05 2014; UDP; eth1; 32 bytes; from 197.46.140.50:1434 
Wed Dec 3 12:52:05 2014; UDP; eth1; 122 bytes; from 197.46.140.50:1434 
Wed Dec 3 12:52:05 2014; UDP; eth1; 32 bytes; from 197.46.140.50:1434 
Wed Dec 3 12:52:05 2014; UDP; eth1; 32 bytes; from 197.46.140.50:1434 
Wed Dec 3 12:52:05 2014; UDP; eth1; 885 bytes; from 197.46.140.50:1434 

我只想

Wed Dec 3 12:52:05 2014; UDP; eth1; 885 bytes; from 197.46.140.50:1434 
Wed Dec 3 12:52:05 2014; UDP; eth1; 652 bytes; from 197.46.140.50:1434 

放到一個文本文件中。超過499字節的任何內容。

回答

4

嘗試這樣做:

$ awk '$8 > 499' file > another_text_file 

無需添加printawkTRUE條件已經打印。

grep這裏不是正確的工具。

相關問題