#!/bin/bash

x=1

for i in `find . -type f`;
  do
    echo $i
    tshark -r $i -R '(ip.src == 1.1.1.1 and ip.dst == 2.2.2.2) or (ip.dst == 1.1.1.1 and ip.src == 2.2.2.2)' -w /home/so/pcap/$x.pcap
    x=$((x+1))
  done

mergecap /home/so/pcap/* -w /home/so/pcap/pcap.out
rm /home/so/pcap/*.pcap
