This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

tshark: “-w” was unexpected in this context.

0

Hello, I wrote a filter like that:

-r "c:\\temp\\test1.pcap" tcp.stream eq 17 -w "c:\\temp\\output\\tcp-stream17.pcap"

However, it says that "-w" was unexpected in this context. Any idea what is wrong? Thank you all.

asked 21 Feb '15, 03:32

Maayan%20Cohen's gravatar image

Maayan Cohen
1111
accept rate: 0%


2 Answers:

1

Simply quoting the filter string doesn't work, you're mixing positional parameter use and explicit named parameter use. Either move the (positional) filter to the end:

-r C:\Temp\test1.pcap -w C:\temp\output\tcp-stream17.pcap tcp.stream eq 17

or add the -Y parameter to indicate it's a display filter (and quote the filter):

-r C:\Temp\test1.pcap -Y "tcp.stream eq 17" -w C:\temp\output\tcp-stream17.pcap

Also note that you don't need to escape the backslashes and as the paths don't have spaces you don't need to quote them either.

answered 21 Feb '15, 10:26

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

edited 21 Feb '15, 10:27

0

Use quotes around your filter expression.

answered 21 Feb '15, 03:56

Jasper's gravatar image

Jasper ♦♦
23.8k551284
accept rate: 18%