What you need is editcap
. It's a command-line tool that is part of the Wireshark family.
Check out the man page at http://www.wireshark.org/docs/man-pages/editcap.html.
It takes a pcap file as input, and writes an output one. You may operate on the infile to filter content, for example, with start-time and end-time, packet number ranges, snap packet length, adjusting timestamps (!), etc. It's a great tool.