# Revision history [back]

To use a capture filter on an already existing file, you would have to use tshark to read from that file an give it the capture filter expression as a value of the -R parameter. So the full command line would be
tshark -r original_pcap_file -R "capture_filter_expression" -w new_pcap_file
However, while it is not possible to write an equivalent of any display filter expression using a capture filter syntax because many protocol fields referred to by display filters are only available after packet dissection, it should be possible to convert any capture filter expression into a display filter expression.

To use a capture filter on an already existing file, you would have to use tshark tcpdump to read from that file an give it the capture filter expression as a value of the -R parameter. filter. So the full command line would be
tshark tcpdump -r original_pcap_file -R "capture_filter_expression" -w new_pcap_filenew_pcap_file -s 0 capture_filter_expression
However, while it is not possible to write an equivalent of any display filter expression using a capture filter syntax because many protocol fields referred to by display filters are only available after packet dissection, it should be possible to convert any capture filter expression into a display filter expression.