Ask Your Question
0

A pcap to csv which seperator to choose

asked 2022-12-09 12:51:52 +0000

rnb gravatar image

I am trying to put some tshark output into a csv file, which is not that hard with " [...]>> file.csv"

But the problem is which separator to choose with "-E separator=[??}". Default is "," but this is also in the output data, so that causes problems, same with ";".

So which is the best, safest, unique separator to choose when converting into csv?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2022-12-09 18:46:19 +0000

André gravatar image

updated 2022-12-09 18:50:59 +0000

The -E separator sets the separator and the default is a tab.
The -E aggregator is used when grouping a field. The default value is a comma, which can be altered too.

Personally I would use -E "separator=;" (note: quoted to avoid shell interpretation) and leave the aggregator as is. Most applications (e.g. Excel) will import this just as easy and avoids decimal point issues in different languages.

You can also use -E quote=d to force quoting all fields, in case some contains a separator or an aggregator character.

edit flag offensive delete link more

Comments

Doesn't Wireshark deliver quoted strings in CSV output?

hugo.vanderkooij gravatar imagehugo.vanderkooij ( 2022-12-12 07:53:26 +0000 )edit

tshark -T fields -e ip.addr without -E quote=d will output unquoted IP addresses (aggregated by comma). At least on Windows and Linux, I cannot check MacOS.

André gravatar imageAndré ( 2022-12-12 17:30:05 +0000 )edit

Thank you for your answer, but unfortunately the -E "separator=;" doesn't work for me. There are already a lot of ";" in the data and these also get interpreted as separators. So I am looking for something unique of something smart.

What also doesn't help, is that I want to view the data in Excel, which gives it's own stupid interpretation of the data and quotes when used.

rnb gravatar imagernb ( 2022-12-16 15:18:01 +0000 )edit

In case of Excel, there are several options to import a custom CSV file, thus set the delimiter and quotes usage. For example:

  • Via menu Data | From Text/CSV
  • Via menu Data | Text to Columns | Delimited, set delimiter and text qualifier. When pasting the plain (CSV) text it will be split accordingly.

You can use any character you want as a delimiter in both Excel as -E quote option. The default tab character works fine too.

André gravatar imageAndré ( 2022-12-23 20:13:29 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-12-09 12:51:52 +0000

Seen: 201 times

Last updated: Dec 09 '22