1MERGECAP(1) The Wireshark Network Analyzer MERGECAP(1)
2
3
4
6 mergecap - Merges two or more capture files into one
7
9 mergecap [ -a ] [ -F <file format> ] [ -h ] [ -s <snaplen> ]
10 [ -T <encapsulation type> ] [ -v ] -w <outfile>⎪- <infile> ...
11
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, it writes the capture file in libpcap format, and writes
19 all of the packets in both input capture files to the output file.
20
21 Mergecap is able to detect, read and write the same capture files that
22 are supported by Wireshark. The input files don't need a specific
23 filename extension; the file format and an optional gzip compression
24 will be automatically detected. Near the beginning of the DESCRIPTION
25 section of wireshark(1) or <http://www.wire‐
26 shark.org/docs/man-pages/wireshark.html> is a detailed description of
27 the way Wireshark handles this, which is the same way Mergecap handles
28 this.
29
30 Mergecap can write the file in several output formats. The -F flag can
31 be used to specify the format in which to write the capture file,
32 mergecap -F provides a list of the available output formats.
33
34 Packets from the input files are merged in chronological order based on
35 each frame's timestamp, unless the -a flag is specified. Mergecap
36 assumes that frames within a single capture file are already stored in
37 chronological order. When the -a flag is specified, packets are copied
38 directly from each input file to the output file, independent of each
39 frame's timestamp.
40
41 The output file frame encapsulation type is set to the type of the
42 input files, if all input files have the same type. If not all of the
43 input files have the same frame encapsulation type, the output file
44 type is set to WTAP_ENCAP_PER_PACKET. Note that some capture file for‐
45 mats, most notably libpcap, do not currently support
46 WTAP_ENCAP_PER_PACKET. This combination will cause the output file
47 creation to fail.
48
50 -a Causes the frame timestamps to be ignored, writing all packets from
51 the first input file followed by all packets from the second input
52 file. By default, when -a is not specified, the contents of the
53 input files are merged in chronological order based on each frame's
54 timestamp.
55
56 Note: when merging, mergecap assumes that packets within a capture
57 file are already in chronological order.
58
59 -F <file format>
60 Sets the file format of the output capture file. Mergecap can write
61 the file in several formats, mergecap -F provides a list of the
62 available output formats. The default is to use the file format of
63 the first input file.
64
65 -h Prints the version and options and exits.
66
67 -s <snaplen>
68 Sets the snapshot length to use when writing the data. If the -s
69 flag is used to specify a snapshot length, frames in the input file
70 with more captured data than the specified snapshot length will
71 have only the amount of data specified by the snapshot length writ‐
72 ten to the output file. This may be useful if the program that is
73 to read the output file cannot handle packets larger than a certain
74 size (for example, the versions of snoop in Solaris 2.5.1 and
75 Solaris 2.6 appear to reject Ethernet frames larger than the stan‐
76 dard Ethernet MTU, making them incapable of handling gigabit Ether‐
77 net captures if jumbo frames were used).
78
79 -v Causes mergecap to print a number of messages while it's working.
80
81 -w <outfile>⎪-
82 Sets the output filename. If the name is '-', stdout will be used.
83 This setting is mandatory.
84
85 -T <encapsulation type>
86 Sets the packet encapsulation type of the output capture file. If
87 the -T flag is used to specify a frame encapsulation type, the
88 encapsulation type of the output capture file will be forced to the
89 specified type, rather than being the type appropriate to the
90 encapsulation type of the input capture files.
91
92 Note that this merely forces the encapsulation type of the output
93 file to be the specified type; the packet headers of the packets
94 will not be translated from the encapsulation type of the input
95 capture file to the specified encapsulation type (for example, it
96 will not translate an Ethernet capture to an FDDI capture if an
97 Ethernet capture is read and '-T fddi' is specified).
98
100 tcpdump(8), pcap(3), wireshark(1), tshark(1), dumpcap(1), editcap(1),
101 text2pcap(1)
102
104 Mergecap is based heavily upon editcap by Richard Sharpe
105 <sharpe[AT]ns.aus.com> and Guy Harris <guy[AT]alum.mit.edu>.
106
107 Mergecap is part of the Wireshark distribution. The latest version of
108 Wireshark can be found at <http://www.wireshark.org>.
109
110 HTML versions of the Wireshark project man pages are available at:
111 <http://www.wireshark.org/docs/man-pages>.
112
114 Original Author
115 -------- ------
116 Scott Renfro <scott[AT]renfro.org>
117
118 Contributors
119 ------------
120 Bill Guyton <guyton[AT]bguyton.com>
121
122
123
1241.0.0 2008-03-29 MERGECAP(1)