Hopefully clarify usage a bit to indicate multiple infile's can be specified to be...
[metze/wireshark/wip.git] / doc / mergecap.pod
1
2 =head1 NAME
3
4 mergecap - Merges two or more capture files into one
5
6 =head1 SYNOPSIS
7
8 B<mergecap>
9 S<[ B<-a> ]>
10 S<[ B<-F> E<lt>I<file format>E<gt> ]>
11 S<[ B<-h> ]>
12 S<[ B<-s> E<lt>I<snaplen>E<gt> ]>
13 S<[ B<-T> E<lt>I<encapsulation type>E<gt> ]>
14 S<[ B<-v> ]>
15 S<B<-w> E<lt>I<outfile>E<gt>|->
16 E<lt>I<infile>E<gt> [E<lt>I<infile>E<gt> I<...>]
17
18 =head1 DESCRIPTION
19
20 B<Mergecap> is a program that combines multiple saved capture files into
21 a single output file specified by the B<-w> argument.  B<Mergecap> knows
22 how to read B<libpcap> capture files, including those of B<tcpdump>,
23 B<Wireshark>, and other tools that write captures in that format.
24
25 By default, B<Mergecap> writes the capture file in B<libpcap> format, and writes
26 all of the packets from the input capture files to the output file.
27
28 B<Mergecap> is able to detect, read and write the same capture files that
29 are supported by B<Wireshark>.
30 The input files don't need a specific filename extension; the file
31 format and an optional gzip compression will be automatically detected.
32 Near the beginning of the DESCRIPTION section of wireshark(1) or
33 L<http://www.wireshark.org/docs/man-pages/wireshark.html>
34 is a detailed description of the way B<Wireshark> handles this, which is
35 the same way B<Mergecap> handles this.
36
37 B<Mergecap> can write the file in several output formats.
38 The B<-F> flag can be used to specify the format in which to write the
39 capture file, B<mergecap -F> provides a list of the available output
40 formats.
41
42 Packets from the input files are merged in chronological order based on
43 each frame's timestamp, unless the B<-a> flag is specified.  B<Mergecap>
44 assumes that frames within a single capture file are already stored in
45 chronological order.  When the B<-a> flag is specified, packets are
46 copied directly from each input file to the output file, independent of
47 each frame's timestamp.
48
49 The output file frame encapsulation type is set to the type of the input
50 files if all input files have the same type.  If not all of the input
51 files have the same frame encapsulation type, the output file type is
52 set to WTAP_ENCAP_PER_PACKET.  Note that some capture file formats, most
53 notably B<libpcap>, do not currently support WTAP_ENCAP_PER_PACKET.
54 This combination will cause the output file creation to fail.
55
56 =head1 OPTIONS
57
58 =over 4
59
60 =item -a
61
62 Causes the frame timestamps to be ignored, writing all packets from the
63 first input file followed by all packets from the second input file.  By
64 default, when B<-a> is not specified, the contents of the input files
65 are merged in chronological order based on each frame's timestamp.
66
67 Note: when merging, B<mergecap> assumes that packets within a capture
68 file are already in chronological order.
69
70 =item -F  E<lt>file formatE<gt>
71
72 Sets the file format of the output capture file. B<Mergecap> can write
73 the file in several formats; B<mergecap -F> provides a list of the
74 available output formats. The default is to use the file format of the
75 first input file.
76
77 =item -h
78
79 Prints the version and options and exits.
80
81 =item -s  E<lt>snaplenE<gt>
82
83 Sets the snapshot length to use when writing the data.
84 If the B<-s> flag is used to specify a snapshot length, frames in the
85 input file with more captured data than the specified snapshot length
86 will have only the amount of data specified by the snapshot length
87 written to the output file.  This may be useful if the program that is
88 to read the output file cannot handle packets larger than a certain size
89 (for example, the versions of snoop in Solaris 2.5.1 and Solaris 2.6
90 appear to reject Ethernet frames larger than the standard Ethernet MTU,
91 making them incapable of handling gigabit Ethernet captures if jumbo
92 frames were used).
93
94 =item -v
95
96 Causes B<mergecap> to print a number of messages while it's working.
97
98 =item -w  E<lt>outfileE<gt>|-
99
100 Sets the output filename. If the name is 'B<->', stdout will be used.
101 This setting is mandatory.
102
103 =item -T  E<lt>encapsulation typeE<gt>
104
105 Sets the packet encapsulation type of the output capture file.
106 If the B<-T> flag is used to specify a frame encapsulation type, the
107 encapsulation type of the output capture file will be forced to the
108 specified type, rather than being the type appropriate to the
109 encapsulation type of the input capture files.
110
111 Note that this merely
112 forces the encapsulation type of the output file to be the specified
113 type; the packet headers of the packets will not be translated from the
114 encapsulation type of the input capture file to the specified
115 encapsulation type (for example, it will not translate an Ethernet
116 capture to an FDDI capture if an Ethernet capture is read and 'B<-T
117 fddi>' is specified).
118
119 =back
120
121 =head1 EXAMPLES
122
123 To merge two capture files together, 100 seconds apart use:
124
125     capinfos -aeS a.pcap b.pcap
126
127 (Let's suppose a.pcap starts at 1009932757 and b.pcap ends
128 at 873660281. 1009932757 - 873660281 - 100 = 136272376
129 seconds.)
130
131     editcap -t 136272376 b.pcap b-shifted.pcap
132     mergecap -w compare.pcap a.pcap b-shifted.pcap
133
134 =head1 SEE ALSO
135
136 tcpdump(8), pcap(3), wireshark(1), tshark(1), dumpcap(1), editcap(1),
137 text2pcap(1)
138
139 =head1 NOTES
140
141 B<Mergecap> is based heavily upon B<editcap> by Richard Sharpe
142 <sharpe[AT]ns.aus.com> and Guy Harris <guy[AT]alum.mit.edu>.
143
144 B<Mergecap> is part of the B<Wireshark> distribution.  The latest version
145 of B<Wireshark> can be found at L<http://www.wireshark.org>.
146
147 HTML versions of the Wireshark project man pages are available at:
148 L<http://www.wireshark.org/docs/man-pages>.
149
150 =head1 AUTHORS
151
152   Original Author
153   -------- ------
154   Scott Renfro             <scott[AT]renfro.org>
155
156
157   Contributors
158   ------------
159   Bill Guyton              <guyton[AT]bguyton.com>