saving raw packet payload to text file

dear all

i have a pcap file that contain data about some protocols. i want to have a text file for every protocol from my pcap file that contains all raws of packet payload in asccii format. just like this:

which command could i use?

please guide me

thanks a lot

GET / HTTP/1.1
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2311.90 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,fa;q=0.6,nl;q=0.4,de;q=0.2

HTTP/1.1 200 OK
Server: nginx/1.4.6 (Ubuntu)
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.5.9-1ubuntu4.9
Set-Cookie: PHPSESSID=agg92fl57l5si815a03tr269h1; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: testcookie=1
Content-Encoding: gzip

redef Conn::default_extract=T;

That will create a directory named “contents” in your CWD and fill it with files containing the data you want. One difference is that Bro writes each flow to a separate file so a connection would write out two files.