Yes, it’s in Windows CMD, in CMD the syntax recommend to use
double quote(“), or it will return error like that: Can't find string terminator "'" anywhere before EOF
at -e line 1. Using that line in CMD: tshark.exe -T pdml -r "MCNew.cap" | perl -ane
"@flist=qw(m3ua.protocol_data_opc m3ua.protocol_data_dpc
h248.transactionId); foreach $f (@flist) { if(/field
name=\"$f\".*show=\"(.*?)\".*/){print
$f,':',$1,',';}}" the result is the same you got before: m3ua.protocol_data_opc:1307690,m3ua.protocol_data_dpc:1307721,h248.transactionId:2046823431, but I thought that if the result is like that m3ua.protocol_data_opc:1307690,m3ua.protocol_data_dpc:1307721,h248.transactionId:2046823431, it will be more easily used by other program. 发件人: wireshark-users-bounces@xxxxxxxxxxxxx
[mailto:wireshark-users-bounces@xxxxxxxxxxxxx] 代表 Martin
Visser I think you
have a shell substitution problem. (I was doing this in Cygwin on Windows,
which would be compatible with Linux/UNIX shells), but I am guess you are doing
this in Windows CMD. On Tue, Jul 13, 2010 at 2:13 PM, damker
<damker@xxxxxxxx> wrote: Thanks, the theory is
ok, but something others happened. My OS is WIN7+ActivePerl
5.10, When using tshark.exe -T pdml -r
"d:\temp\MCNew.cap" | perl -ane
"@flist=qw(m3ua.protocol_data_opc m3ua.protocol_data_dpc
h248.transactionId); foreach $f (@flist) { if(/field
name=\"$f\".*show=\"(.*?)\".*/){print "$f:$1,";}}"
> d:\temp\mcnew.txt error reported: syntax error at -e line 1,
near "$f:" Execution of -e aborted due
to compilation errors. tshark: An error occurred
while printing packets: Invalid argument. When using tshark.exe -T pdml -r
"d:\temp\MCNew.cap" | perl -ane "@flist=qw(m3ua.protocol_data_opc
m3ua.protocol_data_dpc h248.transactionId); foreach $f (@flist) { if(/field
name=\"$f\".*show=\"(.*?)\".*/){print
"$f,$1,";}}" > d:\temp\mcnew.txt result is: m3ua.protocol_data_opc1307690m3ua.protocol_data_dpc1307721h248.transactionId2046823431m3ua.protocol_data_opc1310708m3ua.protocol_data_dpc1307721m3ua.protocol_data_opc1307690m3ua.protocol_data_dpc1307721h248.transactionId3825208323m3ua.protocol_data_opc1307719m3ua.protocol_data_dpc1307721m3ua.protocol_data_opc1307690m3ua.protocol_data_dpc1307721h248.transactionId3288337409m3ua.protocol_data_opc1307817m3ua.protocol_data_dpc1307721m3ua.protocol_data_opc1307690m3ua.protocol_data_dpc1307721h248.transactionId2449476613m3ua.protocol_data_opc1307690m3ua.protocol_data_dpc1307721h248.transactionId752404340 there is no char “,”,any
suggestion to solve this? 发件人: wireshark-users-bounces@xxxxxxxxxxxxx
[mailto:wireshark-users-bounces@xxxxxxxxxxxxx]
代表 Martin Visser Unfortunately each -e field only matches a single instance. You are
better off parsing the PDML output, that outputs all of the fields by iterating
through the field. I have created a perl one-liner that can do this:- 2010/7/12 damker <damker@xxxxxxxx> 发件人: damker [mailto:damker@xxxxxxxx] Help The attachment is a packet captured in the
Mc interface, there are 8 SCTP and upper layers, I want to output all the
m3ua.protocol_data_opc, m3ua.protocol_data_dpc,h248.transactionId in every
M3UA. If put the file in d:\temp\ and using the
command line below: tshark -r d:\temp\MCNew.cap -T fields -E
separator=, -e m3ua.protocol_data_opc -e m3ua.protocol_data_dpc -e
h248.transactionId >d:\temp\h248.txt it output the last m3ua.protocol_data_opc,
m3ua.protocol_data_dpc,h248.transactionId,not all. how to write a correct
command line to output all the fields I want?
|
- Follow-Ups:
- References:
- [Wireshark-users] question, how to output specific fields in a complex packet using tshark command line
- From: damker
- Re: [Wireshark-users] question, how to output specific fields in a complex packet using tshark command line
- From: Martin Visser
- [Wireshark-users] 答复: question, how to output specific fields in a complex packet using tshark command line
- From: damker
- Re: [Wireshark-users] 答复: question, how to output specific fields in a complex packet using tshark command line
- From: Martin Visser
- [Wireshark-users] question, how to output specific fields in a complex packet using tshark command line
- Prev by Date: Re: [Wireshark-users] 答复: question, how to output specific fields in a complex packet using tshark command line
- Next by Date: [Wireshark-users] basic install question
- Previous by thread: Re: [Wireshark-users] 答复: question, how to output specific fields in a complex packet using tshark command line
- Next by thread: Re: [Wireshark-users] 答复: 答复: question, how to output specific fields in a complex packet using tshark command line
- Index(es):