I need to extract out data from wireshark captured data. And I already extracted out these collected data about a specific IP. And the final data that I need is about rtt. And the some lines on the rtt data is null value and I tried it with Excel to filter out these lines with CTRL+G operation. The excel works slowly and some times was stuck without any response.
The format of my data is the following:
Time,Source,Destination,rtt,destport,srcport
2.679784,10.0.4.1,10.0.5.2,,3333,35852
2.71042,10.0.4.1,10.0.5.2,,3333,35854
2.823876,10.0.5.2,10.0.4.1,0.144092,35852,3333
2.840817,10.0.5.2,10.0.4.1,0.130397,35854,3333
2.854966,10.0.4.1,10.0.5.2,0.03109,3333,35852
2.866116,10.0.4.1,10.0.5.2,,3333,35852
2.866121,10.0.4.1,10.0.5.2,,3333,35852
2.866209,10.0.4.1,10.0.5.2,,3333,35852
2.866211,10.0.4.1,10.0.5.2,,3333,35852
So finally, I get the problem solved with python. Here is my code.
data_processing_csv.py:
#!/usr/bin/env python
import csv
filename = 'in.csv'
data_out="out.txt"
fileObject = open(data_out, 'w')
with open(filename) as f:
reader = csv.reader(f)
for row in reader:
if(row[3]!=""):
for i in range(len(row)):
fileObject.write(row[i])
fileObject.write("\t")
fileObject.write("\n")