1MERGECAP(1)             The Wireshark Network Analyzer             MERGECAP(1)
2
3
4

NAME

6       mergecap - Merges two or more capture files into one
7

SYNOPSIS

9       mergecap [ -a ] [ -F <file format> ] [ -h ] [ -s <snaplen> ]
10       [ -T <encapsulation type> ] [ -v ] -w <outfile>|- <infile> ...
11

DESCRIPTION

13       Mergecap is a program that combines multiple saved capture files into a
14       single output file specified by the -w argument.  Mergecap knows how to
15       read libpcap capture files, including those of tcpdump, Wireshark, and
16       other tools that write captures in that format.
17
18       By default, Mergecap writes the capture file in libpcap format, and
19       writes all of the packets from the input capture files to the output
20       file.
21
22       Mergecap is able to detect, read and write the same capture files that
23       are supported by Wireshark.  The input files don't need a specific
24       filename extension; the file format and an optional gzip compression
25       will be automatically detected.  Near the beginning of the DESCRIPTION
26       section of wireshark(1) or
27       http://www.wireshark.org/docs/man-pages/wireshark.html
28       <http://www.wireshark.org/docs/man-pages/wireshark.html> is a detailed
29       description of the way Wireshark handles this, which is the same way
30       Mergecap handles this.
31
32       Mergecap can write the file in several output formats.  The -F flag can
33       be used to specify the format in which to write the capture file,
34       mergecap -F provides a list of the available output formats.
35
36       Packets from the input files are merged in chronological order based on
37       each frame's timestamp, unless the -a flag is specified.  Mergecap
38       assumes that frames within a single capture file are already stored in
39       chronological order.  When the -a flag is specified, packets are copied
40       directly from each input file to the output file, independent of each
41       frame's timestamp.
42
43       The output file frame encapsulation type is set to the type of the
44       input files if all input files have the same type.  If not all of the
45       input files have the same frame encapsulation type, the output file
46       type is set to WTAP_ENCAP_PER_PACKET.  Note that some capture file
47       formats, most notably libpcap, do not currently support
48       WTAP_ENCAP_PER_PACKET.  This combination will cause the output file
49       creation to fail.
50

OPTIONS

52       -a  Causes the frame timestamps to be ignored, writing all packets from
53           the first input file followed by all packets from the second input
54           file.  By default, when -a is not specified, the contents of the
55           input files are merged in chronological order based on each frame's
56           timestamp.
57
58           Note: when merging, mergecap assumes that packets within a capture
59           file are already in chronological order.
60
61       -F  <file format>
62           Sets the file format of the output capture file. Mergecap can write
63           the file in several formats; mergecap -F provides a list of the
64           available output formats. The default is to use the file format of
65           the first input file.
66
67       -h  Prints the version and options and exits.
68
69       -s  <snaplen>
70           Sets the snapshot length to use when writing the data.  If the -s
71           flag is used to specify a snapshot length, frames in the input file
72           with more captured data than the specified snapshot length will
73           have only the amount of data specified by the snapshot length
74           written to the output file.  This may be useful if the program that
75           is to read the output file cannot handle packets larger than a
76           certain size (for example, the versions of snoop in Solaris 2.5.1
77           and Solaris 2.6 appear to reject Ethernet frames larger than the
78           standard Ethernet MTU, making them incapable of handling gigabit
79           Ethernet captures if jumbo frames were used).
80
81       -v  Causes mergecap to print a number of messages while it's working.
82
83       -w  <outfile>|-
84           Sets the output filename. If the name is '-', stdout will be used.
85           This setting is mandatory.
86
87       -T  <encapsulation type>
88           Sets the packet encapsulation type of the output capture file.  If
89           the -T flag is used to specify a frame encapsulation type, the
90           encapsulation type of the output capture file will be forced to the
91           specified type, rather than being the type appropriate to the
92           encapsulation type of the input capture files.
93
94           Note that this merely forces the encapsulation type of the output
95           file to be the specified type; the packet headers of the packets
96           will not be translated from the encapsulation type of the input
97           capture file to the specified encapsulation type (for example, it
98           will not translate an Ethernet capture to an FDDI capture if an
99           Ethernet capture is read and '-T fddi' is specified).
100

EXAMPLES

102       To merge two capture files together, 100 seconds apart use:
103
104           capinfos -aeS a.pcap b.pcap
105
106       (Let's suppose a.pcap starts at 1009932757 and b.pcap ends at
107       873660281. 1009932757 - 873660281 - 100 = 136272376 seconds.)
108
109           editcap -t 136272376 b.pcap b-shifted.pcap
110           mergecap -w compare.pcap a.pcap b-shifted.pcap
111

SEE ALSO

113       tcpdump(8), pcap(3), wireshark(1), tshark(1), dumpcap(1), editcap(1),
114       text2pcap(1)
115

NOTES

117       Mergecap is based heavily upon editcap by Richard Sharpe
118       <sharpe[AT]ns.aus.com> and Guy Harris <guy[AT]alum.mit.edu>.
119
120       Mergecap is part of the Wireshark distribution.  The latest version of
121       Wireshark can be found at <http://www.wireshark.org>.
122
123       HTML versions of the Wireshark project man pages are available at:
124       http://www.wireshark.org/docs/man-pages
125       <http://www.wireshark.org/docs/man-pages>.
126

AUTHORS

128         Original Author
129         -------- ------
130         Scott Renfro             <scott[AT]renfro.org>
131
132
133         Contributors
134         ------------
135         Bill Guyton              <guyton[AT]bguyton.com>
136
137
138
1391.4.10                            2011-11-01                       MERGECAP(1)
Impressum